Project Assignment 2:

Due: Thursday,
September 23
Assignment 2 |
Background:
You have been commissioned by the ABC Oil Company to develop a Java program that helps them to quote the correct price per barrel for oil. Use the decision table below to determine the correct price:
| countryType | customerType | costBarrel | finalCost |
| 1 | 1 | costBarrel = worldMarketPrice * 0.6 | finalCost = costBarrel + (costBarrel * 0.05) |
| 1 | 2 | costBarrel = worldMarketPrice * 0.4 | finalCost = costBarrel |
| 1 | 3 | costBarrel = worldMarketPrice * 1.3 | finalCost = costBarrel + (costBarrel * 0.08) |
| 2 | 1 | costBarrel = worldMarketPrice * 0.6 | finalCost = costBarrel |
| 2 | 2 | costBarrel = worldMarketPrice * 0.4 | finalCost = costBarrel |
| 2 | 3 | costBarrel = worldMarketPrice * 1.3 | finalCost = costBarrel |
For the countryType -
1 = US, 2 = International
For the customerType -
1 = refinery customers
2 = government
customers
3 = public customer (gas stations)
Develop a Java program that accepts the countryType, customerType, and worldMarketPrice values within its constructor. Assign these values into the class attributes.
Create methods to:
1. Determine the finalCost.
Print your answer to the terminal window in the format -
Given Country Type = 1, Customer Type = 3,
World Market Price = $100.00
Cost Per Barrel =
$130.00
Final Cost = $140.40
2. a mutator method to set the countryType
3. an accessor method to return the countryType
4. a mutator method to set the customerType
5. an accessor method to return the customerType
6. a mutator method to set the worldMarketPrice
7. an accessor method to return the worldMarketPrice
Note: Be sure to test for valid input (i.e. No worldMarketPrice values of $0 or below. And no customerTypes that are not allowed. Display an error message to the terminal window if that happens.)
Bonus +10: Instead of displaying a number value for CountryType and CustomerType, display the words for that particular type
For example:
Given Country Type = US, Customer Type =
public customer, World Market Price = $100.00
Cost Per Barrel = $130.00
Final Cost =
$140.40
Submit: Arrange all papers in a clear folder as outlined in the syllabus
Cover Page - Your name, date, and Assignment 2.
Source Code - The complete source code printouts for all classes within your project. Remember to document your developer block (i.e. name, due date, assignment # within each class).
Screen shot printouts - Create screen shots of your picture to demonstrate that it works.
Due: Thursday, September 23
Please send any comments to: jfdoyle@ius.edu
Copyright ©
2001-2004 by cgranda@ius.edu . All
rights reserved.