Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

StudentDemo should contain 3 methods. main ( ) , makeStudent ( ) , and graduateCheck ( ) . This part of the lab is focused

StudentDemo should contain 3 methods. main(), makeStudent(), and graduateCheck(). This part of the lab is focused creating objects of a custom class, and utilizing methods to better organize your program and reduce repetition.
Start with graduateCheck(). It should be defined as public static void and it should accept a single Student object as parameter. All the method needs to do is print can graduate, congratulations! if their canGraduate() method returns true, otherwise print cant graduate, oh well.... Youll need to use getName() for each student here.
Next, do makeStudent(). It should be defined as public static and return a Student object. It should accept a Scanner object as parameter. Start by asking for the necessary information to create a Student their name and year first. Then, ask for how many grades they have, and create a double[] with that size. You can then use a for loop to fill up the array with grades entered by the user. After all that, return the new Student using the information given. Youll also need to flush the stream right before the return since the method ends with nextDouble() and starts with nextLine(). For the grade loop, it should look something like this:
for(int i =0; i < numOfGrades; ++i){
//ask for a grade to add to the array
//grades[i]= that new grade
}
Lastly, you have main(), which will serve as the main program flow. Create a Scanner object and ask for how many students there are. Use a for loop to get Student objects from makeStudent() and call graduateCheck() on each after. Youll need to flush the stream after asking for the number of students and before calling makeStudent the first time. Your for loop should look something like this:
for(int i =0; i < studentNum; ++i){
//retrieve a new student object from makeStudent
//call graduateCheck with that student
}

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_2

Step: 3

blur-text-image_3

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

Divide in the indicated base. 5 6 214 6

Answered: 1 week ago

Question

b. What are its goals and objectives?

Answered: 1 week ago