{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

June 22 - Pi iii Declare variables 1 Int main C 2 Your...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
June 22 1. Variable Types a. Variable is like a box to hold information b. Computers hold a lot more things than integer numbers (x=y+4) c. Volume= 4/3*PI*radius*radius*radius i. Syntax ok (Be careful) ii. Logic ok d. 6 Variable Types i. Int - Integer ii. Float- Floating: point number 9decimals and very precise) iii. Double - decimal number iv. Char - Single alphanumeric character: A, Q, 4, # v. Boolean- true or false vi. String - Text “Hello World” e. Important Steps i. Declare your variables. Give values to the variables. Operate on the variable values output result ii. Program Goal: 1. Get radius circle of the user, and calculate area of circle, then output result Value of
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Pi iii. Declare variables 1. Int main C 2. Your code [double radius; double area; double PI= 3.14159;] 3. (; tells the compiler that this line of code is done, like a period.) 4. /n (new line) 5. Order is not important 6. Spacing is important iv. Legal variable names have letters or _ (underscore) and can have numbers but cannot start with a number. f. Is it legal? i. Int six; ok (spelling matters for commands only ) ii. Int x; ok iii. Char user_choice; ok iv. Double area2; ok v. Double _time; ok vi. Int this4u; ok vii.String 4words; x fourwords 2. Math Operations 3. Input/ Output 4. Overall Program Set Up...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern