Need help with java program!
I am very new to java and was wondering if I can get some help with an assignment. Here is the description of what needs to be done.
1. Create a Java program with proper documentation and indentation.
2. Give a brief description to the user.
3. Mary suggests creating a class named ‘CarTracker’ with two String variables (first and last names of the driver), a double variable to track the fares paid to the driver; a double variable to track the gasoline purchased by the driver; a double variable to track the gasoline used.
4. Display for the user the following and enter the data (use the Scanner class) exactly to test your program:
(type the name in exactly as shown):
Please enter the Driver's first name:
Please enter the Driver's Last name:
Please enter the amount paid to the Driver (fares):
Please enter the amount the Driver paid for gas:
Please enter the distance the Driver travelled:
Please enter the amount of gasoline the Driver used:
5. Create a green panel using a JPanel and JLabels. With the given input (above).
6. Mary suggests using these formulas to determining the output and the client agreed:
mpg = miles-travelled / gas-Used
fares-per-mile = fare / miles-travelled
gas-paid-per-mile = gas-purchased / miles- travelled
profit = fare – gas-purchased;
7. Joe (the IS person) suggests (because of his many years of experience with clients) better looking output by using these Java classes:
DecimalFormat dfmt = new DecimalFormat("0.##");
NumberFormat cfmt = NumberFormat.getCurrencyInstance();
8. Add a driver so you can track two drivers. Use any input for the second driver, however, keep using the same input for the first driver. Create a JPanel for each driver. Have one JPanel be a green color and the other a blue color.
9. Have the name (first and last) appear using the following format: all letters are lower case except for the first letter of the first and last name: (e.g., John Betterdriver). The input for driver one should be exactly as shown above, for example enter in the name: john ‘betterDRIVER’. The output should have the name appear as ‘John Betterdriver’.
10. Also create an icon for each driver. The image you use is up to you, however, use a different image for each driver and place the icon inside the JPanels. Make the output look good.
So those are the guidelines and here is what I have come up with so far. I need help with what i'm mssing and what I still need to have in my program. Any and all help is greatly appreciated.
// This program will Calculate the mileage statistics for a cab company in Allendale
public class CarTracker
public static void main(String[ ] args )
reader = new Scanner( System.in );
System.out.println("Enter the driver's first name");
System.out.println("Enter the driver's last name");
System.out.println("Enter the amount paid to the driver");
System.out.println("Enter the amount the driver paid for gas");
System.out.println("Enter the distance the driver traveled");
// Presents two colored panels nested within a third.
JFrame frame = new JFrame ("Nested Panels");
JPane1 subPanel1 = new JPane1();
subPanel1.setPreferredSize (new dimension(175, 175));
JLabel label1 = new JLabel ("name " + firstname1 + " " + lastname1);
//Set up primary pane
JPanel1 primary = new JPanel();