Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the solution to this in java CSC 1351-02, Spring 2023, Lab 5 Name this project StatisticsDemo Create a project named StatisticsDemo that illustrates

I need the solution to this in javaimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

CSC 1351-02, Spring 2023, Lab 5 Name this project StatisticsDemo Create a project named StatisticsDemo that illustrates the use of interfaces. This project will have the following: 1) An interface named Measurables with the following abstract methods: public int getFirstint (); public int getSecondInt (); public int getThirdInt(); public double getDouble (); 2) A class named Student that implements the Measurables and Comparable interfaces. The Student class will have the following: a) Instance variables : private String name; private int exam1; private int exam2; private int finalExam; private double courseGrade; b) A constructor with four input parameters that give the values of name, exam1, exam2, and finalexam. The constructor does not have an input variable for the value of courseGrade. Instead, the constructor will calculate courseGrade as the average of exam1, exam2, and finalexam. c) Methods : 3) A class named Employee that implements the Measurables and Comparable interfaces. The Employee class will have the following: a) Instance variables: private String name private int hours private int rate private int sales private double netPay b) A constructor with four input parameters that give the values of name, hours, rate, and sales. The constructor does not have an input variable for the value of netPay. Instead, the constructor will calculate netPay as follows: wages is hours times rate. commission is 15% of sales. gross pay is wages plus commission. withholding tax as 18% of the gross pay. netPay is gross pay minus withholding tax. c) Methods : public int getFirstint() // returns hours public int getSecondint() // returns rate public int getThirdint() // returns sales public double getDouble() // returns netpay public int compareTo(Object otherobject) //compares two Employee objects //by netpay public string tostring() //defines a string to print an Employee object //as shown in the output 4) The main class, named StatisticsDemo, with the following two methods: public static void main (String [] args) The main method is given in the starter code. public static double [] averages (Measurables [] objects) NOTE: The method averages in this lab calculates and returns an array of four averages instead of returning just one average like the method average in the example program MeasurableDemo does. Output Students : (Mary Exam1=85, Exam2=93, Final=97, Course Grade=91.7), (Bob Exam1=67, Exam2=77, Final=71, Course Grade=71.7), (Tom Exam1=85, Exam2=91, Final=89, Course Grade=88.3), (Anna Exam1=79, Exam2=72, Final=80, Course Grade=77.0), (Hal Exam1=96, Exam2=88, Final=99, Course Grade=94.3), (Gina Exam1=89, Exam2=91, Final=82, Course Grade=87.3)] Average Exam 1 Grade =83.50 Average Exam 2 Grade =85.33 Average Final Exam Grade =86.33 Average Course Grade =85.06 After sorting students by course grade, Students : (Bob Exam1=67, Exam2=77, Final=71, Course Grade=71.7), (Anna Exam1=79, Exam2=72, Final=80, Course Grade=77.0), (Gina Exam1=89, Exam2=91, Final =82, Course Grade=87.3), (Tom Exam1=85, Exam2=91, Final=89, Course Grade=88.3), (Mary Exam1=85, Exam2=93, Final=97, Course Grade=91.7), (Hal Exam1=96, Exam2=88, Final=99, Course Grade=94.3)] Employees: (Sara Hours =68, Rate =$19, Sales =$5473, Net Pay =$1732.62 ), (Sam Hours =51, Rate =$18, Sales =$5829, Net Pay =$1469.73 ), (Lisa Hours =47, Rate =$16, Sales =$3892, Net Pay =$1095.36 ), (Jim Hours =33, Rate =$21, Sales =$4857, Net Pay =$1165.67 ), (Judy Hours =39, Rate =$23, Sales =$4295, Net Pay =$1263.83 ) ] Average Hours =47.60 Average Rate =$19.40 Average Sales =$4869.20 Average Net Pay =$1345.44 After sorting employees by net pay, Employees: (Lisa Hours =47, Rate =$16, Sales =$3892, Net Pay =$1095.36 ), (Jim Hours =33, Rate =$21, Sales =$4857, Net Pay =$1165.67 ), (Judy Hours =39, Rate =$23, Sales =$4295, Net Pay =$1263.83 ), (Sam Hours =51, Rate =$18, Sales =$5829, Net Pay =$1469.73 ), (Sara Hours =68, Rate =$19, Sales =$5473, Net Pay =$1732.62 ) ]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions

Question

a. Do team members trust each other?

Answered: 1 week ago

Question

a. How will the leader be selected?

Answered: 1 week ago