COMP 110-003 Spring 2013

Lab 1

25 points

Assigned: Thursday, January 19
Due: Thursday, January 24

Description

In Eclipse, create a New Java Project called lab1

Part 1

On the course webpage you will find VendingMachine.java. Copy and paste the program into a new Java class in Eclipse (in project lab1). Run (green circle with white arrow in it) VendingMachine.java. Don't forget to change the header at the top of the program to say your name. In the textbook on page 74 (67 for 5th Ed) you will find pseudocode for VendingMachine.java. Read through the pseudocode (Read pages 74-77 (67-70 for 5th ED)) 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

Collaboration

Grading

How to hand in the assignment