JEF9:58 oo AT&T; 100% public asu.edu ASU CSE 110 Assignment #5 Due date/Time: We
ID: 3803865 • Letter: J
Question
JEF9:58 oo AT&T; 100% public asu.edu ASU CSE 110 Assignment #5 Due date/Time: Wednesday, March 29, 2017 at 5:30pm What this Assignment is About: Given a UML diagram, learn to design a class. Leam how to define constructor, accessor, mutator and toString()methods, etc. Leam how to create an object and call an instance method. Leam where to use this keyword Leam how to use static variables & static methods File provided AssignmentSjava Coding Guidelines for All LabsAssignments oou will be graded on this) Give identifiers seman meaning and make them easy to read (examples numStudents, gross Pay, etc). Keep identifiers to a reasonably short length Use upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables, methods, objects). Use tabs or spaces to indent code within blocks (code surrounded by braces). This includes classes, methods, and code associated with ifs, switches and loops. Be consistent with the number of spaces or tabs that you use to indent. Use white space to make your program more readable. Use comments properly before or after the ending brace of classes, methods, and blocks to identify to which block it belongs. Assignment description 1.Step AL According to the following UML diagram, design a Student class, save the souce code as Student java Student quality Points student Estring Instance variables and methods' description variable Data Type Description represents a students unique ID number.such as2Explanation / Answer
/**************Student.java***********************/
import java.util.*;
import java.lang.*;
import java.io.*;
class Student{
private int id,creditHours;
static int numOfStudents=0;
private String name;
private double qualityPoints;
public Student(){
name="????";
qualityPoints=0.0;
creditHours=0;
id=numOfStudents+1;
numOfStudents++;
}
public Student(String name,double qualityPoints,int creditHours){
this.name=name;
this.qualityPoints=qualityPoints;
this.creditHours=creditHours;
id=numOfStudents+1;
numOfStudents++;
}
public String getName(){
return name;}
public void setName(String name){
this.name=name;}
public double calcGPA(){
return qualityPoints/creditHours;}
public void addCourse(double courseGrade,int courseHours){
qualityPoints=courseGrade*courseHours;
this.creditHours=creditHours+courseHours;
}
public static int getNumStudents(){
return numOfStudents;}
public String toString(){
return (" ID: "+this.id+" Name: "+this.name+" GPA: "+this.calcGPA());
}
public static void main(String args[]){ //this is sample run of the Student class
Student s1=new Student("Jane Doe",8,2);
Student s2=new Student("John Smith",10,5);
System.out.println(s1.toString()+" "+s2.toString());
System.out.println("Number of students " +getNumStudents());
}
}
/**********Assignment.java*************/
Please provide the partially filled code to accordingly
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.