COMP 110-003 Fall 2008

Lab 1

25 points

Assigned: Friday, August 29
Due: Friday, September 5 by 2:00pm

Description

Part 1

On the course webpage you will find VendingMachine.java. Copy and paste the program into a new Java file in jGRASP. Compile (green plus sign) and run (red running man) VendingMachine.java. Don't forget to change the header at the top of the program to say your name. In the textbook on page 70 (4th edition) or page 68 (5th edition) you will find pseudocode for VendingMachine.java. Read through the pseudocode and make sure you understand the algorithm. Place each line of pseudocode into VendingMachine.java as comments directly above the line or lines that complete the action. The first line of pseudocode is already in the code as a comment. You may abbreviate the pseudocode comments when you place them into the code.

Part 2

On the course webpage you will find TotalCost.java. You need to complete this program so that it calculates the total cost of a new coat including tax. (The user will input the cost of the coat and the tax rate.) Write pseudocode for how you would solve this problem. Following your pseudocode, complete the program TotalCost.java. Just like Part 1 insert your pseudocode as comments into your program.
NOTE: you are dealing with money so you should declare your variables as double, a number with decimal points, instead of int, whole numbers. Also, when reading doubles from the keyboard you would write keyboard.nextDouble() instead of keyboard.nextInt().

Additional Questions

Grading

How to hand in the assignment