Answer to Question #247475 in Java | JSP | JSF for Memo

Question #247475
Design a console application that will print the final result obtained by a student with the weighting of
each module. Make use of an abstract class named Student that contains variables to store the
student number, test result, assignment result and exam. Create a constructor that accepts the
student number, test result, assignment result and the exam result as parameters and create get
methods for the variables. The Student class must implement an iReport interface that contains the
following:
public interface iReport {
public void print_report();
}
Create a subclass called Student_Report that extends the Student class. The Student_Report class
must contain a constructor to accept the student number, test, assignment and exam results as
parameters. Write code for the print_report method which calculates each assessment weighting as
follows:
Assessment Weighting
Test 25%
Assignment 25%
Exam 50%
Finally write a useStudent class to instantiate the Student_Report class
1
Expert's answer
2021-10-06T16:09:44-0400


interface iReport {
	public void print_report();
}


class Student implements iReport {


	private int studentNumber;
	private int test;
	private int assignment;
	private int examResults;


	public Student(int studentNumber, int test, int assignment, int examResults) {
		this.studentNumber = studentNumber;
		this.test = test;
		this.assignment = assignment;
		this.examResults = examResults;
	}


	@Override
	public void print_report() {
		// Assessment Weighting
		// Test 25%
		// Assignment 25%
		// Exam 50%
		System.out.println("Student number: " + studentNumber);
		System.out.println("Test weight: " + (test * 0.25));
		System.out.println("Assignment weight: " + (assignment * 0.25));
		System.out.println("Exam weight: " + (examResults * 0.5));
	}


	/**
	 * @return the studentNumber
	 */
	public int getStudentNumber() {
		return studentNumber;
	}


	/**
	 * @param studentNumber the studentNumber to set
	 */
	public void setStudentNumber(int studentNumber) {
		this.studentNumber = studentNumber;
	}


	/**
	 * @return the test
	 */
	public int getTest() {
		return test;
	}


	/**
	 * @param test the test to set
	 */
	public void setTest(int test) {
		this.test = test;
	}


	/**
	 * @return the assignment
	 */
	public int getAssignment() {
		return assignment;
	}


	/**
	 * @param assignment the assignment to set
	 */
	public void setAssignment(int assignment) {
		this.assignment = assignment;
	}


	/**
	 * @return the examResults
	 */
	public int getExamResults() {
		return examResults;
	}


	/**
	 * @param examResults the examResults to set
	 */
	public void setExamResults(int examResults) {
		this.examResults = examResults;
	}
}


class Student_Report extends Student {


	public Student_Report(int studentNumber, int test, int assignment, int examResults) {
		super(studentNumber, test, assignment, examResults);
	}
}


public class useStudent {


	public static void main(String[] args) {


		Student_Report student_Report = new Student_Report(4564, 50, 40, 60);
		student_Report.print_report();
	}
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS