Studying for exam 2

# Studying for exam 2 - Studying for exam 2 read the book...

• Notes
• 1

This preview shows page 1. Sign up to view the full content.

Studying for exam 2, read the book. Loops example, counting a number, using the for loop counter, initializing a variable, conditional statements, elseif if, ch. 19, ch.20. Binary numbers and table in ch 19. The syntax for the conditional operators and double and equal greater than less than. Put an example of an elseif else. Don’t put logical statements on the same line as an else. Phase diagram—can pretty much guarantee you’ll see one. %This program will ask the user to input a product price and the cash given to pay for it. It will then %return the change back including the number of pennies, nickels, dimes, quarters and dollars in a table %format. % Assumptions: The customer will give the user more money than the purchase price. There is
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: no sales %tax. The customer is only purchasing one item and is using American currency. % Input: % P=product price in dollars %c=cash supplied by customer in dollars % Output: %D=the change portion in dollars %q=the change portion in quarters %d=the change portion in dimes %n=the change portion in nickels %p=the change portion in pennies While c is greater than or equal to one dollar, divide it by 1. That will be dollars. So if I have 5.32 divide by 1, display no decimal points While c is greater than or equal to 25 cents, divide it by 25 that will be quarters While c is greater than...
View Full Document

• Fall '11
• JAMESHORN
• United States dollar, change portion

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern