Hi, since I'm new to java I already failed my first assignment this is my referral assignment I'm only set to gain about 49% Grade mark A, so as a lot of people are probably used to seeing this assignment I was wondering if someone could help me real quick
"User Requirements Set A
1. Car records:
a. add a new car
b. for a given registration number print the car’s details
c. print a list all cars that are for sale (i.e. where the price paid for is zero)"
Now I've done what I'm guessing is correct but I can't get BlueJ to recognise a damn increment and not quite sure what I'm doing wrong hopefully maybe one of you guys can help me out.
So this would be my Main part of the program
Any help, I would be greatful
--- Update ---
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.text.SimpleDateFormat; import java.util.*; /** * Write a description of class Main here. * * @author (your name) * @version (a version number or a date) */ public class Main { private ArrayList<Cars> cars;// Array for storing cars; /** * Constructor for objects of class Main */ public Main() { cars = new ArrayList<Cars>(); } /** * An example of a method - replace this comment with your own * * @param y a sample parameter for a method * @return the sum of x and y */ public void addNewCar(String carReg, String carMake, String carModel) { // This is where I'm stuck to set the increment! } } And this would be the car class /** * Write a description of class Cars here. * * @author (your name) * @version (a version number or a date) */ public class Cars { // instance variables - replace the example below with your own private String carReg; private String carModel; private String carMake; private double pricePaid; private double priceSold; /** * Constructor for objects of class Cars */ public Cars(String carReg, String carModel, String carMake, double pricePaid, double priceSold) { this.carReg = carReg; this.carModel = carModel; this.carMake = carMake; this.pricePaid = pricePaid; this.priceSold = priceSold; } public Cars() { this.carReg = "MM03KBU"; this.carMake = "Ford"; this.carModel = "Mondeo"; this.pricePaid = 1900.00; this.priceSold = 2199.50; } /** * * * An example of a method - replace this comment with your own * * @param y a sample parameter for a method * @return the sum of x and y */ /** * the 'return', */ public String getcarReg() { return carReg; } public String getcarNake() { return carMake; } public String getModel() { return carModel; } public double pricePaid() { return pricePaid; } public double priceSold() { return priceSold; } public void printCarDetails() { System.out.println("Car Reg" + carReg); } }
--- Update ---
Sorry for double posting, I couldn't post the coding for some reason