The Woody furniture company sells the following three styles of chairs:
Style Price Per Chair
American Colonial $ 85.00
Modern $ 57.50
French Classical $127.75
Write a program that will input the amount of chairs sold for each style. It will print the total dollar sales of each style as well as the total sales of all chairs in fixed point notation with two decimal places.
Sample run:
Please input the number of American Colonial chairs sold
20
Please input the number of Modern chairs sold
15
Please input the number of French Classical chairs sold
5
I would start by declaring 3 variables, asking the user for the number of chairs sold, and prompting for that number of chairs sold, and then running the calculations, and outputing those calculations.
Yes, that's why I said you need to review your notes. There is a point where you can't get any more basic, and to solve this kind of problem all you have to do is ask yourself:
1) What can I do?
2) How can I apply this to the problem?
Also, always break problems up into small, solvable units.
If for example the the problem at hand is "remove a line from a text file" you'd break it down to:
1) read the file line by line into a collection
2) remove the line from the collection
3) write the lines back into the file.
1) Is broken down to
1.1) Declare a collection to store the lines
1.2) Open a file
1.3) Read lines until you hit eof
1.3.1) add each read line into the collection
1.4) close the file
2) depends on the collection type, if it's a list it's already "solved", if it's an array or a vector or something like that
2.1)create a temporary collection variable
2.2)move the lines from your line collection to the temporary, but skip the line you want to delete
2.3)destroy the original line collection and make the temporary the new one
3) is basically 1 in reverse
3.1)Open a file
3.2)iterate over the collection and write each member into the file as a line
3.3)Close the file
You may or may not have to explicitly destroy the collection now, depending on the type of collection used.