Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Design Question

  1. Dec 20, 2004 #1
    Hello all

    I have an exam tomorrow on Program Design and OOP Concepts. The majority of the exam will consist of questions that test your ability in distinguishing between terms. This will be the easy part. However, the more difficult portion of the test will contain a free response problem of multiple parts called a "design question."

    Can you verify if I am doing this correctly:

    Design a class to represent CAR. Instance variables stored about a car should be:

    1. the make(Toyota, Ford)
    2. mileage
    3. the total gallons used
    4. whether the car is an economy model, a moderately fuel efficient car or a gas guzzler.
    5. miles per gallon
    6. vehicle weight

    Clients of this class should be able to access to find out the value of all attributes about a car. Clients should be able to modify instance variables 1, 2, 3, and 6. In writing the design, do not write any code. Just declare the instance variables and write the header for the methods.

    My code:
    Code (Text):
    public class Car {

    private string make;
    private double mileage;
    private double totalgal;
    private string classcar;
    private double milespergal;
    private double vehicleweight;
    private double milespergallon;

    public string getMake {

    public double mileage {

    I am not sure if I am doing this correctly. Do I put accessors and modifiers for each of the methods? How would I call the methods?

    Any help is greatly appreciated

    Last edited: Dec 20, 2004
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted