Write a program in Java that prompts a user for Name and id number. and then the program outputs students GPA
MAIN
import java.util.StringTokenizer;
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
String thedata =
JOptionPane.showInputDialog(null, "Please type in Student Name. ",
"Student OOP Program", JOptionPane.INFORMATION_MESSAGE);
String name = thedata;
Student pupil = new Student(name);
//add code here
String outputmsg = "The Pupil: " +
pupil.getName();
outputmsg = outputmsg + "\nID: " +
pupil.getIDnumber();
outputmsg = outputmsg + "\ngrade
point average is " + pupil.getGradePoint();
JOptionPane.showMessageDialog(null,
outputmsg);
}
}
Student
public class Student {
// the private data members
private int idNumber;
private int hours;
private int points;
private String name = "";
// Constructor
Student(String Name) {
idNumber = 0;
points = 60;
hours = 15;
name = Name;
}
// end of constructor added in part c
// the public get and set methods
public void setIDnumber(int number) {
idNumber = number;
}
public String getName() {
return name;
}
public int getIDnumber() {
return idNumber;
}
//add here
public double getGradePoint() {
return (points * 1.0 /
hours);
}
}
/* Changed source code is */
import java.util.StringTokenizer;
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
String thedata = JOptionPane.showInputDialog(null, "Please type in Student Name. ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE);
String name = thedata;
thedata = JOptionPane.showInputDialog(null, "Please type in Student ID. ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE);
int idNumber = Integer.parseInt(thedata);
thedata = JOptionPane.showInputDialog(null, "Please type hours ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE);
int hours = Integer.parseInt(thedata);
thedata = JOptionPane.showInputDialog(null, "Please type Points ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE);
int points = Integer.parseInt(thedata);
//Student pupil1 = new Student(name); //Call this for default
Student pupil = new Student(name, idNumber, points, hours);
pupil.setIDnumber(idNumber);
String outputmsg = "The Pupil: " + pupil.getName();
outputmsg = outputmsg + "\nID: " + pupil.getIDnumber();
outputmsg = outputmsg + "\ngrade point average is " + pupil.getGradePoint();
JOptionPane.showMessageDialog(null, outputmsg);
}
}
class Student {
// the private data members
private int idNumber;
private int hours;
private int points;
private String name = "";
// Constructor
Student(String Name) {
idNumber = 0;
points = 60;
hours = 15;
name = Name;
}
Student(String Name,int idNumber,int points,int hours){
this.idNumber = idNumber;
this.points = points;
this.hours = hours;
this.name = Name;
}
// end of constructor added in part c
// the public get and set methods
public void setIDnumber(int number) {
idNumber = number;
}
public String getName() {
return name;
}
public int getIDnumber() {
return idNumber;
}
//add here
public double getGradePoint() {
return (points * 1.0 / hours);
}
}
/* Editor screen*/


/* Output Window*/

/* Final output screen*/

/* Thanks*/
Write a program in Java that prompts a user for Name and id number. and then...
Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...
Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...
IN JAVA Ask the user for three employees. Store the data into three employee objects (use the Employee class from the previous question). Display those employees in a table. On this question, you'll submit two files: Employee.java and some other file that has a main. Standard Input Bill Gates 1234 Engineering Engineer Elon Musk 4443 Business CEO Steve Jobs 9999 Creative Designer Required Output -- Employee Entry Form --\n Enter name\n Enter ID\n Enter department\n Enter position\n -- Employee...
write comments // on this program please //Inside package bloodDonation //BloodDonor.java class package bloodDonation; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Scanner; public class BloodDonor { long idNumber, cardNumber; String name, bloodGroup, homePhone, mobilePhone, address, lastDateOfDonation; SimpleDateFormat myFormat = new SimpleDateFormat("dd MM yyyy"); public BloodDonor(){ this.idNumber = 0; this.cardNumber = 0; this.name = ""; this.bloodGroup = ""; this.homePhone = ""; this.mobilePhone = ""; this.address = ""; ...
Java Programming --- complete the given classes DeLand Space Car Dealer needs a new program for their inventory management system. The program needs the following classes: A main class (SpaceCarDealer.java) that includes the main method and GUI. Two instantiable classes: CarDealer.java o Variables to store the dealer name, and the carsOnLot array in Car type. o A constructor to initialize the name variable with the given dealer name. o An accessor method to return the name of the dealer. o...
Given attached you will find a file from Programming Challenge 5 of chapter 6 with required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions: An empty string is given for the employee’s name. An invalid value is given to the employee’s ID number. If you implemented this field as a string, then an empty string could be invalid. If you implemented this field as a numeric variable, then a...
I need code in java
The Student class:
CODE IN JAVA:
Student.java file:
public class Student {
private String name;
private double gpa;
private int idNumber;
public Student() {
this.name = "";
this.gpa = 0;
this.idNumber = 0;
}
public Student(String name, double gpa, int
idNumber) {
this.name = name;
this.gpa = gpa;
this.idNumber = idNumber;
}
public Student(Student s)...
Modify the objectstudent JAVA program to add a private variable zipcode, you must also add setters and getter methods for the new variable and modify the toString method. The objectstudent program is in this weeks module, you can give it a default value of 19090. class Student { private int id; private String name; public Student() { id = 8; name = "John"; } public int getid() { return id; } public String getname() { return name; } public void...
Need help with the program
DemoSugarSmash.java
import java.util.*;
public class DemoSugarSmash
{
public static void main(String[] args)
{
// Complete the demo program here
}
}
PremiumSugarSmashPlayer.java
public class PremiumSugarSmashPlayer
{
// Define the PremiumSugarSmashPlayer class here
}
PremiumSugarSmashPlayer.java
public class SugarSmashPlayer {
private int playerID;
private String screenName;
private int[] scoresArray ;
public SugarSmashPlayer() {
this.scoresArray = new int[10];
}
public SugarSmashPlayer(int levels) {
this.scoresArray = new int[levels];
}
public int getIdNumber() {
return playerID;
}
public void setIdNumber(int...
How to solve and code the following requirements (below) using the JAVA program? 1. Modify the FoodProduct Class to implement Edible, add the @Overrride before any methods that were there (get/set methods) that are also in the Edible interface. 2. Modify the CleaningProduct Class to implement Chemical, add the @Overrride before any methods that were there (get/set methods) that are also in the Chemical interface. 3. Create main class to read products from a file, instantiate them, load them into...