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 5 of 5

Thread: New assignment

  1. #1
    Member clarky2006's Avatar
    Join Date
    Nov 2012
    Posts
    84
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Thumbs up New assignment

    Quote Originally Posted by Norm View Post
    Glad you got it working.
    Hi Norm, I ve got this project today, just wondering if you would be able to help us sort out what classes I need. I know I do need a Car class and stock but not just car and stock class..cheers......



    Introduction to Programming
    Learning Objectives
    The following learning objectives are covered by this assignment
    Learning outcome Assessment criteria
    1 have understood and learnt the
    programming language syntax and
    constructs
    can create and/or recognise syntactically
    correct code for specified aspects of the
    programming language syntax and
    constructs
    2 write simple code to demonstrate
    appropriate use of differing aspects
    of syntax
    writes code for a precisely specified
    outcome
    3 design and program a solution to a
    given problem
    designs, implements and tests a program
    to solve a given problem
    When reading this assignment brief DON’T PANIC it has been written so that it provides a challenge
    for the strongest programming students but also enables other students to demonstrate they can
    create simple Java programs.
    Scenario
    Delboy trotter’s Second-hand Car Dealership
    Delboy Trotter has a second hand car business wherehe buys and sells used cars. His business is
    growing and he wants to replace his paper based system for keeping track of his car stock and sales:
    Car
    He keeps basic information about each car he has bought and sold e.g. make, model, the price
    Delboy paid for it and the price he sold it for. Typical data would be
    Car Information Typical data
    make Ford
    model Mondeo
    registration number MM03KBU
    price paid 1900.00
    price sold for 2199.50
    When he buys a car the ‘price sold for’ will be 0.00 (zero)
    Stock
    This entity is a list of all cars he has bought andsold. It also provides all the functionality required to
    maintain the collection of cars. The expected functionality for this class is shown on the next page.
    Page 3 of 6
    System user requirements (functionality / methods)
    User Requirements Set A Max mark
    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)
    49%
    User Requirements Set B
    2. Car records:
    a. return a car with a particular member registration number
    b. search for and print all cars of a particular make e.g. all Fords
    c. remove a car with a particular car registration number
    59%
    User Requirements Set C
    3. Car records
    a. search for and print all cars of a particular make and model (e.g.
    all Ford Mondeo’s) that are for sale
    b. print a list of all cars that have been sold (donot include those for
    sale) and the profit made on each. Also print the total profit made
    on all sales.
    69%
    User Requirements Set D
    4. Car records (For this you will need to work withdates)
    a. modify the car class so that you can record the date of sale.
    b. print a list of all cars sold in a particular month and year and the
    total profit made..
    99%
    IMPORTANT NOTE
    If you have been referred then your mark will be capped at 40% but if you have been deferred your
    mark is not capped so it is worth attempting as much of this as possible.
    Page 4 of 6
    Some guidelines to creating the software
    Step 1
    You are obviously going to need a class to model the car so you should create this first. For this
    class:-
    •identify and define the fields required, these canbe found in the scenario.
    •create a parameter constructor to simplify the creation of car objects
    •create accessor and mutator methods for each field
    •create a method that prints the objects details onone line, this will be useful when you want to
    print a list of members or cars.
    Step 2
    Once you have created the car class you can then create the stock class which will be used to
    maintain the collection of cars.
    •define a field of type ArrayList for the cars
    •create a constructor that will create/instantiate the ArrayList
    •create methods to implement the functionality on page 3 – each user requirement would be a
    separate method in this class
    Functionality set 4 requires you to work with datesI recommend that you investigate the Java library
    class GregorianCalendar.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: New assignment

    Way too much reading for me.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member clarky2006's Avatar
    Join Date
    Nov 2012
    Posts
    84
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: New assignment

    Quote Originally Posted by clarky2006 View Post
    Hi Norm, I ve got this project today, just wondering if you would be able to help us sort out what classes I need. I know I do need a Car class and stock but not just car and stock class..cheers......



    Introduction to Programming
    Learning Objectives
    The following learning objectives are covered by this assignment
    Learning outcome Assessment criteria
    1 have understood and learnt the
    programming language syntax and
    constructs
    can create and/or recognise syntactically
    correct code for specified aspects of the
    programming language syntax and
    constructs
    2 write simple code to demonstrate
    appropriate use of differing aspects
    of syntax
    writes code for a precisely specified
    outcome
    3 design and program a solution to a
    given problem
    designs, implements and tests a program
    to solve a given problem
    When reading this assignment brief DON’T PANIC it has been written so that it provides a challenge
    for the strongest programming students but also enables other students to demonstrate they can
    create simple Java programs.
    Scenario
    Delboy trotter’s Second-hand Car Dealership
    Delboy Trotter has a second hand car business wherehe buys and sells used cars. His business is
    growing and he wants to replace his paper based system for keeping track of his car stock and sales:
    Car
    He keeps basic information about each car he has bought and sold e.g. make, model, the price
    Delboy paid for it and the price he sold it for. Typical data would be
    Car Information Typical data
    make Ford
    model Mondeo
    registration number MM03KBU
    price paid 1900.00
    price sold for 2199.50
    When he buys a car the ‘price sold for’ will be 0.00 (zero)
    Stock
    This entity is a list of all cars he has bought andsold. It also provides all the functionality required to
    maintain the collection of cars. The expected functionality for this class is shown on the next page.
    Page 3 of 6
    System user requirements (functionality / methods)
    User Requirements Set A Max mark
    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)
    49%
    User Requirements Set B
    2. Car records:
    a. return a car with a particular member registration number
    b. search for and print all cars of a particular make e.g. all Fords
    c. remove a car with a particular car registration number
    59%
    User Requirements Set C
    3. Car records
    a. search for and print all cars of a particular make and model (e.g.
    all Ford Mondeo’s) that are for sale
    b. print a list of all cars that have been sold (donot include those for
    sale) and the profit made on each. Also print the total profit made
    on all sales.
    69%
    User Requirements Set D
    4. Car records (For this you will need to work withdates)
    a. modify the car class so that you can record the date of sale.
    b. print a list of all cars sold in a particular month and year and the
    total profit made..
    99%
    IMPORTANT NOTE
    If you have been referred then your mark will be capped at 40% but if you have been deferred your
    mark is not capped so it is worth attempting as much of this as possible.
    Page 4 of 6
    Some guidelines to creating the software
    Step 1
    You are obviously going to need a class to model the car so you should create this first. For this
    class:-
    •identify and define the fields required, these canbe found in the scenario.
    •create a parameter constructor to simplify the creation of car objects
    •create accessor and mutator methods for each field
    •create a method that prints the objects details onone line, this will be useful when you want to
    print a list of members or cars.
    Step 2
    Once you have created the car class you can then create the stock class which will be used to
    maintain the collection of cars.
    •define a field of type ArrayList for the cars
    •create a constructor that will create/instantiate the ArrayList
    •create methods to implement the functionality on page 3 – each user requirement would be a
    separate method in this class
    Functionality set 4 requires you to work with datesI recommend that you investigate the Java library
    class GregorianCalendar.

    Ok, I ll try and simplify things, just thought I do give you as much information as possible...

    --- Update ---

    hi, norm, just wondered if these primitive numbers are float or double? 1900.00/2199.50

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: New assignment

    Quote Originally Posted by clarky2006 View Post
    Ok, I ll try and simplify things, just thought I do give you as much information as possible...

    --- Update ---

    hi, norm, just wondered if these primitive numbers are float or double? 1900.00/2199.50
    The quickie answer -- double since it is much more precise than float at minimal cost to you the programmer. The real-world answer is to go with BigDecimal since you almost never want to represent financial data as floating point numbers. BigDecimal does add significant computation time and data overhead cost though, but where the precision is needed, the cost is worth it.

  5. The Following User Says Thank You to curmudgeon For This Useful Post:

    clarky2006 (February 11th, 2013)

  6. #5
    Member clarky2006's Avatar
    Join Date
    Nov 2012
    Posts
    84
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: New assignment

    Quote Originally Posted by curmudgeon View Post
    The quickie answer -- double since it is much more precise than float at minimal cost to you the programmer. The real-world answer is to go with BigDecimal since you almost never want to represent financial data as floating point numbers. BigDecimal does add significant computation time and data overhead cost though, but where the precision is needed, the cost is worth it.
    cheers mate........

Similar Threads

  1. Need help with my assignment
    By kohii in forum What's Wrong With My Code?
    Replies: 14
    Last Post: February 4th, 2012, 02:40 AM
  2. assignment troubles polymorphism (guide for assignment included)
    By tdawg422 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 8th, 2011, 10:01 AM
  3. Help with assignment
    By NPVinny in forum What's Wrong With My Code?
    Replies: 12
    Last Post: July 3rd, 2010, 05:31 PM
  4. please help me in my assignment :(
    By asdfg in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 18th, 2010, 07:59 AM
  5. Replies: 1
    Last Post: February 22nd, 2010, 07:20 AM