Question

Design a console application that will print the final result obtained by a student with the...

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. Sample output is shown below and you may hard code the same values to test your application.

STUDENT REPORT

********************************

STUDENT NUMBER: 11007

TEST WEIGHTING: 20

ASSIGNMENT WEIGHTING: 18.75

EXAM WEIGHTING: 32.5

FINAL RESULT: 72.25%

*********************************

0 0
Add a comment Improve this question Transcribed image text
Answer #1

There is a total of four files for the assignment.

1. iReport.java which contains the interface mentioned in the question.

2. Student.java which contains the abstract class and all the necessary methods and variables.

3. Student_Report.java which extends the class Student.

4. useStudent.java which contains the main method.

Note: I have used the hardcoded values.

Code for iReport.java

// interface

public interface iReport {

    public void print_report();

}

Code for Student.java

// abstract class Student which implements iReport interface

abstract class Student implements iReport {

    // data membets

    String studentNumber;

    double testResult;

    double assignmentResult;

    double examResult;

    // constructor

    public Student(String number, double test, double assignment, double exam) {

        studentNumber = number;

        testResult = test;

        assignmentResult = assignment;

        examResult = exam;

    }

    // getters

    public String getStudentNumber() {

        return studentNumber;

    }

    public double getTestResult() {

        return testResult;

    }

    public double getAssignmentResult() {

        return assignmentResult;

    }

    public double getExamResult(){

        return examResult;

    }

}

Code for Student_Report.java

// class Student_Report extends the abstract class Student

// if we do not Override print_report() method than this class will also become abstract class.

// and if a class is abstract class then we cannot make object of that class. We can only make reference of that abstract class

class Student_Report extends Student {

    // constructor

    public Student_Report(String number , double test , double assignment , double exam ){

        super(number, test, assignment, exam);

    }

    @Override

    public void print_report() {

        System.out.println("STUDENT REPORT");

        System.out.println("***************************");

        System.out.println("STUDENT NUMBER:" + this.getStudentNumber());

        System.out.println("TEST WEIGHTING:" + this.getTestResult());

        System.out.println("ASSIGNMENT WEIGHTING:" + this.getAssignmentResult());

        System.out.println("EXAM WEIGHTING:"+ getExamResult());

        System.out.println("FINAL RESULT:" + (getExamResult() + getAssignmentResult() + getTestResult()));

        System.out.println("***************************");

        

    }

}

Code for useStudent.java

// useStudent class

public class useStudent{

    // main method

    public static void main(String[] args) {

        // creating object of Student_Report class

        Student_Report studentReport = new Student_Report("11007", 20, 18.75, 32.5);

        // calling print_report method to print the report

        studentReport.print_report();

    }

}

Screenshot of the test run

Feel free to comment for any doubt and give thumbs up!

Thank you!

Add a comment
Know the answer?
Add Answer to:
Design a console application that will print the final result obtained by a student with the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MasterMind in Java Activity MasterMind project Create a new Java Application project named MasterMind allowing Netbeans...

    MasterMind in Java Activity MasterMind project Create a new Java Application project named MasterMind allowing Netbeans IDE to create the main class called MasterMind.java MasterMind class Method main() should: Call static method System.out.println() and result in displaying “Welcome to MasterMind!” Call static method JOptionPane.showMessageDialog(arg1, arg2) and result in displaying a message dialog displaying “Let’s Play MasterMind!” Instantiate an instance of class Game() constants Create package Constants class Create class Constants Create constants by declaring them as “public static final”: public...

  • 1-Suppose you write an application in which one class contains code that keeps track of the...

    1-Suppose you write an application in which one class contains code that keeps track of the state of a board game, a separate class sets up a GUI to display the board, and a CSS is used to control the stylistic details of the GUI (for example, the color of the board.) This is an example of a.Duck Typing b.Separation of Concerns c.Functional Programming d.Polymorphism e.Enumerated Values 2-JUnit assertions should be designed so that they a.Fail (ie, are false) if...

  • using c/c++ Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average...

    using c/c++ Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average that Receives two integer numbers as parameter and returns the average Is used in a main function. Main() stays in a loop and asks user to enter 2 numbers and then shows the average using the Average function above Define a class named Student with following members: private data: 2 grades and a GPA (average). public constructor to initialize the members a public function...

  • Create an abstract Student class for Parker University. The class contains fields for student ID number,...

    Create an abstract Student class for Parker University. The class contains fields for student ID number, last name, and annual tuition. Include a constructor that requires parameters for the ID number and name. Include get and set methods for each field; the setTuition() method is abstract. Create three Student subclasses named UndergraduateStudent, GraduateStudent, and StudentAtLarge, each with a unique setTuition() method. Tuition for an UndergraduateStudent is $4,000 per semester, tuition for a GraduateStudent is $6,000 per semester, and tuition for...

  • ****Here is the assignment **** Purpose: To write an Object-Oriented application that creates a Java class...

    ****Here is the assignment **** Purpose: To write an Object-Oriented application that creates a Java class with several instance variables, a constructor to initialize the instance variables, several methods to access and update the instance variables’ values, along with other methods to perform calculations. Also, write a test class that instantiates the first class and tests the class’s constructor and methods. Details: Create a class called Rectangle containing the following: Two instance variables, An instance variable of type double used...

  • // Client application class and service class Create a NetBeans project named StudentClient following the instructions...

    // Client application class and service class Create a NetBeans project named StudentClient following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. Add a class named Student to the StudentClient project following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. After you have created your NetBeans Project your application class StudentC lient should contain the following executable code: package studentclient; public class...

  • Java Project In Brief... For this Java project, you will create a Java program for a...

    Java Project In Brief... For this Java project, you will create a Java program for a school. The purpose is to create a report containing one or more classrooms. For each classroom, the report will contain: I need a code that works, runs and the packages are working as well The room number of the classroom. The teacher and the subject assigned to the classroom. A list of students assigned to the classroom including their student id and final grade....

  • a) Create an abstract class Student. The class contains fields for student Id number, name, and...

    a) Create an abstract class Student. The class contains fields for student Id number, name, and tuition. Includes a constructor that requires parameters for the ID number and name. Include get and set method for each field; setTuition() method is abstract. b) The Student class should throw an exception named InvalidNameException when it receives an invalid student name (student name is invalid if it contains digits). c) Create three student subclasses named UndergradStudent, GradeStudent, and StudentAtLarge, each with a unique...

  • Sammy’s Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists....

    Sammy’s Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. Create a Rental class for the company. The class contains: Two public final static fields that hold the number of minutes in an hour and the hourly rental rate ($40) Four private fields that hold a contract number, number of hours for the rental, number of minutes over an hour, and the price. The contract number is stored as a String because Sammy plans...

  • C++ program Create a Student class that contains three private data members of stududentID (int), lastName...

    C++ program Create a Student class that contains three private data members of stududentID (int), lastName (string), firstName(string) and a static data member studentCount(int). Create a constructor that will take three parameters of studentID, lastName and firstName, and assign them to the private data member. Then, increase the studentCount in the constructor. Create a static function getStudentCount() that returns the value of studentCount. studentCount is used to track the number of student object has been instantiated. Initialize it to 0...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT