Answer to Question #56628 in Java | JSP | JSF for Lindoln Noah Garcia
2. Create a JAVA program that will input a student name, course, student grade in quiz, seatwork, laboratory exercises, assignment and prelim exam. Compute and output the Prelim Grade. Prelim Grade = Quiz * 25% + Seatwork * 10% + lab. Exercise * 20% +
Assignment * 5% + Prelim Exam * 40%
1
2015-12-02T08:02:46-0500
Student.java
public class Student {
private String name;
private String course;
private double quiz;
private double seatwork;
private double laboratory;
private double assignment;
private double prelimExam;
public Student() {
}
public void setName(String name) {
this.name = name;
}
public void setCourse(String course) {
this.course = course;
}
public void setQuiz(double quiz) {
this.quiz = quiz;
}
public void setSeatwork(double seatwork) {
this.seatwork = seatwork;
}
public void setLaboratory(double laboratory) {
this.laboratory = laboratory;
}
public void setAssignment(double assignment) {
this.assignment = assignment;
}
public void setPrelimExam(double prelimExam) {
this.prelimExam = prelimExam;
}
public double getPrelimGrade() {
return quiz * 0.25 + seatwork * 0.1 + laboratory * 0.2 + assignment * 0.05 + prelimExam *0.4;
}
}
Question.java
import java.util.Scanner;
public class Question {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Student st1 = new Student();
System.out.print("Name : ");
st1.setName(sc.nextLine());
System.out.print("Course : ");
st1.setCourse(sc.nextLine());
System.out.print("Quiz : ");
st1.setQuiz(sc.nextDouble());
System.out.print("Seatwork : ");
st1.setSeatwork(sc.nextDouble());
System.out.print("Laboratory : ");
st1.setLaboratory(sc.nextDouble());
System.out.print("Assignment : ");
st1.setAssignment(sc.nextDouble());
System.out.print("Prelim exam : ");
st1.setPrelimExam(sc.nextDouble());
System.out.print("Prelim grade : ");
System.out.println(st1.getPrelimGrade());
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF
Comments
Leave a comment