Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

127 publie votd c2) Lab Activitios: Student Class In this lab, you will ) wribe in Jaa a class that represents a model of a

image text in transcribed
127 publie votd c2) Lab Activitios: Student Class In this lab, you will ) wribe in Jaa a class that represents a model of a L. Draw the U Il. Write a Java source code for a class named Student. Use the Java kes I(I.) to refer to the referenced object, and (2.) to call a typical student and (2) a test class to test it. class diagram for your design (relating the 2 classes below). sure all the data field members (data fields) areprivate, 1. The class Student represents a typical student (in the form of keyword this in its TWO forns of usage from another constructor) everywhere you can. Make s student ' a lava objecp, Wite the stde s briefly described below A university student object, an instance (object) of Student class, has the state (expressed via its private data felds) can be defined as the student's name, address, mojor, and GPA , and via its methods) is to update the address and to recalculate the GPA behavior ( (ex address, major are EACH of String data type, the GPA data field is a double (1) The Student data fields name, data type. They must be declared private Use the Java this keyword to call one of the coestructors from the other. or takes a name, eddress, and mgjor. It also shouald have a call to comput eGPA.I. methold (2) Write hwo constructors. (see below how) to set the GP takes as formal parameters a name and address. Use this Java keyword to call When you call the first constructor with this, for the major argument, use the String the first constructor. value "Undeclared" set methods (also called mutators, setters) for the data fields/ instance variables: name, address, and ie, do not implement a set method for the GPA data field [since it is calculated/set by the computeGPA () method] 59) Implement get methods (also called accessons, getters) for ell of the instance variables (ie, incl. one for th Xa Write the computeGPA 0 void method. In it, to calculate the GPA, generate and return a random dou between 0.5 and 4.0. [Here, use the random 0 method of the Math class (import it in the beginning of t GPA). A program with the import java. lang.Math directive)] 7) Include a tostring () method to return the output for each student in the following format (notice,this is an me: Jeremy George iress: 1598 See Dr. or: Computer Science : 3.45 When you prepare the format of the GPA number, make sure that you have only 2 digits a decimal point (as in the above example: 3.45) for that purpose, to achieve it, make sure that y insde the tostring() method, instead of only the GPA data field, use the fellovsing for method. format

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago