Assignment class The Assignment class should have the following three instance variables: String name double availablePoints double earnedPoints The constructor heading should be: public Assignment(String name, double availablePoints, double earnedPoints) Test class

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In this lesson, we are going to create an Assignment superclass with a Test and Project subclass.

Assignment class

The Assignment class should have the following three instance variables:

  • String name
  • double availablePoints
  • double earnedPoints

The constructor heading should be:

public Assignment(String name, double availablePoints, double earnedPoints)

Test class

The Test class should have the following instance variable:

  • String testDate

The constructor heading should be:

public Test(String name, double availablePoints, double earnedPoints, String testDate)

Project class

The Project class should have the following instance variables:

  • String dueDate
  • boolean groups

The constructor heading should be:

public Project(String name, double availablePoints, double earnedPoints, String dueDate, boolean groups)

Each class should have getters and setters for each of its instance variables.

AssignmentRunner class

The AssignmentRunner should loop and prompt users for an assignment name until they enter exit. After getting the name, it should prompt the user for each of the pieces of information needed to create either a test or a project.

Once the user has finished entering information, the program should call a static method to calculate the average (total points earned / total points available * 100).

Note: Remember that the Scanner nextInt(), nextBoolean(), and nextDouble() lines only read part of the line. Don’t forget to use a nextLine() before reading a new string! Check out the slides for lesson 1.6 starting on slide 21 for more details.
Lesson 1.6 Slides

Sample Output

Please enter an assignment name (exit to quit): Array Test Please enter the available points: 100 Please enter the earned points: 95 Is this a (t)est or (p)roject: t Please enter the test date: 4/25 Please enter an assignment name (exit to quit): MadLibs Project Please enter the available points: 75 Please enter the earned points: 75 Is this a (t)est or (p)roject: p Please enter the due date: 4/15 Group project? true or false: true Please enter an assignment name (exit to quit): exit Your average: 97.14285714285714

Also Note: Your output must contain the phrase Your Average: to pass the autograder.

----------------------------------------------
public class Assignment
{

}
----------------------------------------------
public class Project extends Assignment {


}
----------------------------------------------

import java.util.*;

public class AssignmentRunner {

public static void main(String[] args) {

// Start here

}

public static double average(ArrayList<Assignment> assignments) {


}
}

----------------------------------------------

public class Test extends Assignment {


}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY