Project 2

1. You are to write a simple program with two classes. One controller class and
a class to hold your object definition. (Similar to what we used in class)
2. Use a package in your project, the package name should be xxxprojectname.
xxx is your initials taken from the first three characters of your Cal Poly email
address.
3. Read in the following from the JOptionPane input window:
a. Customer First Name
b. Customer Last Name
c. Customer Phone Number (example: 9093873744)
d. Number of Vehicles to be manufactured (example: 5)
e. Number of fuel tanks to be mounted on the vehicle.
4. Make sure the following is entered correctly, otherwise display an error message
and close the program:
California State Polytechnic University, Pomona
Computer Information Systems Department
Introduction to Object-Oriented Programming with Java
a. The first name of the customer is not blank
b. The last name of the customer is not blank
c. The phone number of the customer is not blank and is 10 characters
d. The number of vehicles is between 1 and 10 (includes 1 and 10)
e. The number of fuel tanks can only be (2,4,8,10, 15,20)
5. Compute the cost for manufacturing vehicles using the price of $500.19 per
vehicle
6. Compute the cost for fuel tanks using the price of $2.15 per fuel cell.
7. For this project each vehicle tank holds 12 Fuel Cells and vehicles can have more
than one tank.
8. Use the following formulas to perform the calculations:
Cost for manufacturing = number of vehicles * manufacturing price
Cost for fuel tanks = number of vehicles * number of tanks * number
of fuel cells per tank * price of fuel cell
9. Then you are to test the program using the data listed below. In the case of the
first customer enter the data that has errors as shown in the screenshots below.
The program should prompt you to reenter the data until the data is valid.
First Name Last Name Phone Number of Vehicles Number of Tanks
Homer Simpson 9093429871 5 8
Bart Simpson 9093429872 2 2
Lisa Simpson 9093429873 4 15
Marge Simpson 9093429874 3 4
Make sure that you check that the data is valid when the user enters it, Note in the example
below how some data entered is incorrect the program then asks you to enter it again.
Enter First Name
Last Name
California State Polytechnic University, Pomona
Computer Information Systems Department
Introduction to Object-Oriented Programming with Java
Enter Phone
Enter Number of Vehicles
Enter Number of Tanks
Display the summary as follow
California State Polytechnic Univer

You can leave a response, or trackback from your own site.
Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes