Work out as the following exercises from the textbook. Do not add them to your assignment submission, though you should keep them in your electronic portfolio in a separate directory of your pair's repository, e.g., Portfolio-myName-02.
Problems:
These problems should be checked into your pair's SVN repository by the due date.
Project naming requirements
The names of the projects and some of the project files must be exactly the same as specified in the assignment. Failure to do so makes it impossible for the graders to run your submission and results in immediate loss of at least 50% of the homework credit.
Make sure you follow the style guidelines for code indentation.
Create a project with the name HW02Problem1. Your java file must be named Cities.java and the Examples class inside this file must be named ExamplesCities.
Convert your data representation for US cities from the previous assignment into data definitions in the FunJava language. (i.e., create a class City)
Make sure you have a separate class Loc for the location coordinates in latitude and longitude
To represent numbers that are not integers, please use Java double primitive data type.
Define a class hierarchy that represents a list of cities. Follow the Design Recipe for Data Definitions. Remember to make examples of data in the ExamplesCities class.
Create a project with the name HW02Problem2. Answers to this problem should be placed in a Java file named Lunches.java and the Examples class inside this file must be named ExamplesLunches.
The goal of this problem is to give you some design freedom, to make you think about the information and how it can be represented as data.
Design the classes (i.e., a class hierarchy) to represent lunch orders in a soup and salad bar. For lunch a customer can choose a soup (soups have different flavors), a salad (one of several kinds, as well as a choice of several choices of dressings), and a bread. For each of the lunch parts we need to know whether or not they are vegetarian.
Note: Salad dressing can be non-vegetarian, for example if they contain bacon bits. There are varieties of breads one can ask for, such as rolls, whole wheat bread, bread sticks, or Hungarian Bacon Biscuits (Pogacsa) --- yes, they contain bacon or chitterlings.
The restaurant has different prices for every soup and for every salad, but all breads cost the same and there is no extra charge for dressing for the salad.
Make examples of at least two of each: soup, salad, dressings, and breads.
Make at least four examples of lunch orders where at least one of them must be vegetarian.
Note:Make these examples as if you were actually ordering the lunch, i.e., write down on a piece of paper the information you are hoping to represent in your code. Use these notes later to guide you in designing exmples of data for your data definitions.
Now design the class that represents the entire lunch order, this class should be named Lunch. Of course, you will need several other classes, maybe a union of classes, maybe a class that references another class, etc. You can name all the other classes and interfaces as you wish, but make sure your names are sensible and that your class names start with a capital letter and the interface names start with the capital letter I.
Convert your original examples of lunch orders into data in the ExamplesLunches class.