Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Overview For this semester, you will be doing a number of labs and projects usin

ID: 3638548 • Letter: O

Question

Overview
For this semester, you will be doing a number of labs and projects using the same class over and over again. You’ll be using it for labs/projects like a linked list of objects, stack of objects, queue of objects, tree of objects. Some of the projects will be like maintaining a database of objects where you will interact with the user to add, update, and delete from the database.
Instead of you being forced to do a specific class, you can create your own class as long as it isn’t a Rectangle, Cube, Car, Coin, or Circle (or Butt)
The class you create must have at least 2 attributes, you need at least 1 constructor that will receive at least 1 parameter, you need setters and getters for each of the fields where applicable *remember how the Car class had a getSpeed() but didn’t have a setSpeed() - it had brake() and accelerate() ]
If you can’t think of a good class and are lost as to what to do, here is an example:
Cheese class with attributes a String of cheeseType and a double of cheesePrice. The constructor would receive parameters newCheeseType and newCheesePrice. The methods would be getCheeseType(), getCheesePrice(), setCheeseType(), setCheesePrice()
Project Details
For this review project, you are to create a Class of your own choosing (other than Rectangle / Cube / Car / Coin / Circle / Butt) and use that class
You are to:
? prompt the user for the attributes (Scanner or JOptionPane)
? create the object in memory using the user’s input
? Display the attributes from the object using the getters.
A Sample Run (using Cheese class):
Enter the type of cheese: Cheddar
Enter the price of the cheese: 1.99
Cheese type: Cheddar
Cheese price: 1.99
Press any key to continue . . .



Grading Rubric for your Class file [ ClassName.java ]: (50 Points)
? Comment in program with name (2 points)
? following the naming guidelines for Classes and identifiers (8 points)
? At least 2 class fields created as requested (5 points)
? At least one Constructor created as requested receiving parameters (5 points)
? setter/getter methods as appropriate (20 points)
? proper indenting (methods indented inside class, statements indented inside method) (5 points)
? organization of your Class( instance variable up top / Constructor / setters/getters ) (5 points)
? -3 points if program does not compile and -1 point for each syntax error
Grading Rubric for driver file [ Project1.java or ClassNameDriver.java or something ]: (50 Points)
? prompting the user (Scanner or JOptionPane) for the attributes of the object(10 points)
? Creation of object in code (5 points)
? Displaying values from object using the getters (15 points)
? Comment in program with name (2 points)
? following the naming guidelines for Classes and identifiers (8 points)
? proper indenting (5 points)
? organization of your code(Get/Calc/Display) (5 points)
? -3 points if program does not compile and -1 point for each syntax error

Explanation / Answer

import javax.swing.JOptionPane; class Student { final double ASSIGNMENT_ONE_PERCENTAGE = .10; final double ASSIGNMENT_TWO_PERCENTAGE = .10; final double ASSIGNMENT_THREE_PERCENTAGE = .10; final double ASSIGNMENT_FOUR_PERCENTAGE = .10; final double MIDTERM_PERCENTAGE = .25; final double FINALEXAM_PERCENTAGE = .25; final double PARTICIPATION_PERCENTAGE = .10; String name, finalLetterGrade; int assignmentOne = 0; int assignmentTwo = 0; int assignmentThree = 0; int assignmentFour = 0; int midterm = 0; int finalExamGrade = 0; int participation = 0; double finalNumericGrade = 0; public Student() { System.out.println (" Initializing Student..."); } public void inputGrades() { name=JOptionPane.showInputDialog("Enter Student's full Name:"); assignmentOne = Integer.parseInt(JOptionPane.showInputDialog( "Enter the Assignment One Grade" )); assignmentTwo = Integer.parseInt(JOptionPane.showInputDialog( "Enter the Assignment Two Grade" )); assignmentThree = Integer.parseInt(JOptionPane.showInputDialog( "Enter the Assignment Three Grade" )); assignmentFour = Integer.parseInt(JOptionPane.showInputDialog( "Enter the Assignment Four Grade" )); midterm = Integer.parseInt(JOptionPane.showInputDialog( "Enter the Midterm Grade" )); finalExamGrade = Integer.parseInt(JOptionPane.showInputDialog( "Enter the Final Examination Grade" )); participation = Integer.parseInt(JOptionPane.showInputDialog( "Enter the Participation Grade" )); } public double getAverage(){ finalNumericGrade = (assignmentOne * ASSIGNMENT_ONE_PERCENTAGE) + (assignmentTwo * ASSIGNMENT_TWO_PERCENTAGE) + (assignmentThree * ASSIGNMENT_THREE_PERCENTAGE) + (assignmentFour * ASSIGNMENT_FOUR_PERCENTAGE) + (midterm * MIDTERM_PERCENTAGE) + (finalExamGrade * FINALEXAM_PERCENTAGE) + (participation * PARTICIPATION_PERCENTAGE); return finalNumericGrade; } private String letterGrade(){ if (finalNumericGrade >= 93) finalLetterGrade = "A"; else if ((finalNumericGrade >= 85) & (finalNumericGrade < 93)) finalLetterGrade = "B"; else if ((finalNumericGrade >= 78) & (finalNumericGrade < 85)) finalLetterGrade = "C"; else if ((finalNumericGrade >= 70) & (finalNumericGrade < 78)) finalLetterGrade = "D"; else if (finalNumericGrade < 70) finalLetterGrade = "F"; return finalLetterGrade; } public String toString() { String studentStringValue= " Student Name is: "+name +" "; studentStringValue+= " Assignment One grade is: " + assignmentOne + " "; studentStringValue+=" Assignment Two grade is: " + assignmentTwo + " "; studentStringValue+=" Assignment Three grade is: " + assignmentThree + " "; studentStringValue+=" Assignment Four grade is: " + assignmentFour + " "; studentStringValue+=" Midterm grade is: " + midterm + " "; studentStringValue+=" Final Exam is: " + finalExamGrade + " "; studentStringValue+=" Participation grade is: " + participation + " "; studentStringValue+=" Final Numeric Grade is: " + finalNumericGrade + " "; studentStringValue+=" Final Letter Grade is: " + finalLetterGrade +" "; return studentStringValue; } public void printName(){ System.out.print(" "+name); } }