Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE COMPLETE CORRECTLY SHOW WORK AND EXPLAIN For this exercise, you will create a student class to hold student data. You should create appropriate variables

PLEASE COMPLETE CORRECTLY SHOW WORK AND EXPLAIN image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
For this exercise, you will create a student class to hold student data. You should create appropriate variables in your student class to store the following information: First name Last name Grade level - an integer value ranging from 0 to 12 with Orepresenting kindergarten GPA-a decimal value ranging from 0 to 4.5. Student ID - an Integer value which is automatically assigned (see below). The student IDs are assigned in order: the first student has an ID of 1, the second student ID is 2, the next is 3, and so on. When a new Student Object is created, your code should automatically Initialize student id to the next integer value. For example, if the last created Student's student id is 17, the next student id generated should be 18. Your student class shot include the following public methods: Student 1) - Constructs a new student with first name and last name set to "None", grade level set to and GPA set to 0.0. The student id should automatically be set to the next integer. . student. Steing firstrane, string lasthana, Int radeleveka double roa) - Constructs a new student with variables initialized to the values specified. The grade level should only be allowed to range between 0 and 12 inclusive, O represents kindergarten. Otherwise, set the grade level to 0. The GPA should only be allowed to range from 0.0 to 4.5, inclusive. Otherwise, set the GPA to 0.0. The student ld should automatically be set to the next integer. String testringt) - Returns the student Information as a String in the following format (notice that the last name is printed first and that there are line breaks after the first name and GPA): Dovi, nes . GPR: 4.0 Grade Level: 74 To test your code prior to submission, use the file runner Student.java. Run the runner Student.moin method and verity that the output matches the sample run below. Don't add your own main method to the Student class as this will lead to your code being checked and scored incorrectly. Sample Run Input student first name or "default for default values, "q" to quit: default None, None GPA: 0.0 Grade Level: oldal Input student first name or defolt for default values, "q" to quit: default None, None GPA0.0 Grade Level: Old 2 Input student first default for default valus," to quit: Inout student last name bovi Input year 2 Input GPA Dovt, s GPA 3.4 Grace Level: 713 Input student first name or "default for default values, "" to quit Student.java runner Student.java 14 1. import java.util.Scanner; 2 - public class runner_Student public static void main(String[] args) { Scanner scan = new Scanner(System.in); 5 boolean go true; 6 - while(go) 7 System.out.println("Input student first name or \"default" for defoult values, \"\" to quit: "); 8 String in scan.nextLine(); 9- if(fn.equals("default")) { 10 Student s = new Student(); 11 System.out.println(" " + s + " "); 12 13 eise if(fn.equals("")) go - false; 15 16 elser 17 System.out.println("Input student last name: "); 18 String in scan.nextLine(); 19 System.out.println("Input year:"); 20 scan.nextInt(); 21 System.out.printin("Input GPA: "); 22 double scan.nextDouble(); Students new Student(fn, in, y, e); 24 System.out.println(" ". . " "); 25 scan.nextLine(); 26 27 28 ) 29 1 38 Inty

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

discuss digital marketing implementation

Answered: 1 week ago

Question

Project management skills and/or experience desirable

Answered: 1 week ago