Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Del boy dealership

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Del boy dealership

    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


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Del boy dealership

    not quite sure what I'm doing wrong
    If there are error messages, copy the full text and paste it here.
    If the program's output is not what you want, post the output and add some comments showing what you want it to be.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 1
    Last Post: February 8th, 2013, 07:37 AM
  2. [SOLVED] I just need help with this WHOLE program, O boy.
    By jwb4291 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: August 1st, 2010, 01:59 PM