Start New Discussion within our Software Development Community

I am so confused in how to go about starting this, I have the information i need to input into the program but seeing the structure on how the program is laid out is my problem. Any example would be of great help.

1. Sandwich class to simulate the sandwich entity in real world

2. Customer class to simulate the customer entity in real world

3. TimeStamp class to represent the order line that contains sandwich (object), customer (object), date and time

4. A ContentOutput class that provides the behaviors of writing the content of an orderline object to the output text file

5. A java application, named SandwichApp.java, that contains the main method

The first step is to write the Sandwich and Customer classes. These are in my opinion the best procedure when writing a class:

1. Define the various components of the state of the object (its properties). Set them all as private variables.

2. Create accessor and mutator (get + set) methods to access encapsulated variables.

3. Create a default and a specified constructor that sets the variables to their initial values.

4. Create other methods that manipulate the properties of this class.

5. Create other methods that involve inter-class interaction (i.e. compareTo() and equals() methods)

Do this to get you through the first 2 steps. Then build your TimeStamp class using instances of these 2 classes as parameters. Each TimeStamp should have a single sandwich, customer, time, and date.

Create SandwichApp.java with a main method that holds a list of timestamps. It should also use the input mechanisms from the ContentOutput class. Write whichever class you want to first.

...Anyway, that's how I would structure my code and tackle the problem if I were you.

This article has been dead for over six months. Start a new discussion instead.