Question
This is example: // Class example from book on Object locations -Comping objects (addresses) public class DemoA { public static void main(String[] args) { double
This is example:
// Class
problem start right here:
In class Exercise 5 Student Class
// Using the in class example <DemoA> for the main routine and <StudentA> as the class
// Create a new class <StudentB> & a new main class <DemoB> in separate .java file but in the same package. See Files, In Class Ex., Chapter 5: for demoA.java and StudnetA files
// 1) for <StudentB> Modify <StudentA> to add a new method <setGrads> to be able to
// randomly assign grads from 0. to 100. into the array in < StudentB > of length [4].
// (use Math.random)
// The existing method to find the average grade < getAverage > should still work.
// 2) Modify <DemoA> to create <DemoB>
// Hint (delete unnecessary existing print statement first)Then run to make sure it runs
// Create (build) 4 instances (objects) of <StudentB> std1std4
// Assign names for std1,std2,std3 and leave std4 as
// std1 will be your first and last together for Ex. Peter_Baker for me.
// std2,std3 can be any name ; AND assign std4 = std1, then output all 4 names
// 3) invoke < setGrads> which is in Class <StudentB> to set the random grades
// for all 4 instances (objects) you created std1,std2..
// For each instance built find the average grade using < getAverage> in <StudentB>
// 4) for all 4 instances you created output the student name & the grade to two decimals
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started