Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Overview this semester, you will be doing a numer of labs and projects that are a collection of objects. Such linked list of objects, stack

image text in transcribed
image text in transcribed
image text in transcribed
Overview this semester, you will be doing a numer of labs and projects that are a collection of objects. Such linked list of objects, stack of objects were of objects, tree of objects. Some of the projects will be maintain a collection of objects where you will interact with the user to add, update, and delete from the collection of objects. For the labs, you will need to test your conection with a specific class from the instructor, but you can also test it with the class you create here for Project 1 Echidden classes: For this project, you are create your own class as long as it isn't a class that the instructor has provided in the Demo Files, or written by the instructor in class, or any other class assiened. For example: cannot be car, Cheese, coin, commemorativeCoin, Course, Food, Instructor Bar Pay Pizza Rectangle, StorageDrive, SolidstateDrive, TextBook, Trip, Truck, Vehicle. Yet to be seen: Card, Graph, Linked Lists Queue, Stack, free. The class also can't be "inappropriate" such as Butt. 1 The class you create must have at least 2 private attributes of which at least one is a string and one is a numeric (int or double) (too many attributes (> 3 ) is just busy work for yourself...It would be easier for future labs/projects if the 2 attributes can uniquely identify an object) you need at least 1 constructor that will receive at least 2 parameters (to uniquely identify a specific object) o you can have a no-arg constructor and you can have additional constructors, but some of the other labs/projects will require you to instantiate a unique object with parameters You need setters and getters for each of the fields where applicable Example: the Car class has a getSpeed() but doesn't have a setSpeed() - it has brakel) and accelerate() both which affect speed) Later in the semester, you will add the following additional methods to the class: O equals() o compareTo) o if either of the prior methods are submitted as part of Project 1, they will be peeked ar but only graded in terms of indenting, variable names, javadoc Honors Option / Extra Credit Create a super-class and a sub-class where an instance of the sub-class has the minimal attributes defined for the class above (at least 2 attributes one String and one numeric, at least 1 constructor at least 1 parameter). You can't use Food and Cheese because you can't use Cheese. Data type and Input comments Rule of thumb: using 'money' like price? Use a double. 2.10 Getting a String from user? User .nextLine() so that a space is allowed in String. Dr. Pepper For the driver: prompt the user for the attributes (Scanner or JOptionPane) instantiate an instance of the class using the variables that have the user input Example: ? mycheese = new Cheese [description Entered, priceEnter monthsAgedEntered): Display the attributes from the obiect using the petters Example: System.out.println("Description:- + myCheese.getDescription()); Although the driver requested does not coll the setters/mutators, it does not mean you do not need to write the setters/mutators in the class. Class Ideas If you can't think of a good class some examples are: Guitars Games. Sodas, Candy, Portals, Animals, Pets, Zombie Pets, Magical Powers, Magical Zombie Powers. Weapons. Magical Zombie Pet Weapons, Zombie Portals if you still can't think of a good class and are lost as to what to do, use this one: Soda class o attributes (private) name a String price a double or calories as int O The constructor would receive parameters: . initialName a String . initialPrice a double or initialCalories as int The methods would be getName() returns a String getPrice() returns a double or getCalories() returns an int setName() expects a parameter - String setPrice()expects a parameter -a double or setCalories() expects a parameter-int Superclass/Subclass? (Honors Option Requirement / Extra Credit) o Beverage as superclass with name and price Soda as subclass with calories A Sampie un using Soda class): nter name for soda: Diet Mountain Dew Enter price for Soda: 2.10 Enter calories for soda 195 Name: Diet Mountain Dew Price: 2.10 Calories: 195 Grading Rubric for your Class file (ClassName.java ): (70 Points) Note: class cannot be a forbidden class! See page 1 Comment in class with name (2 points) following the naming guidelines for Classes and identifiers (8 points) At least 2 private class fields created as requested (8 points) (one a String and one numeric) At least one Constructor created as requested receiving parameters (5 points) setter/getter/mutator methods as appropriate (based on 4pts each - 16 points) Comments in Javadoc format for constructor(s) and methods (3 pts each block-15 points) proper indenting (methods indented inside class, statements indented inside method) (8 points) organization of your Class( class variables up top / Constructor / then setters/getters) (8 points) Grading Rubric for driver (Project1.java or ClassNameDriver.java or something like that]: (30 Points) Comment in program with name (2 points) prompting the user (Scanner or JOptionPane) for the attributes of the object(6 points) Instantiation of object using variables for user input (6 points) (if using a super/sub class the driver only needs to reference the sub class) Displaying values (console or JOptionPane) from object using the getters (6 points) following the naming guidelines for Classes and identifiers (5 points) proper indenting (5 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions