Write main program that can serve as a test class

Assignment Help Programming Languages
Reference no: EM13802398

Programming Problems-              

1. Create an application called Registrar that has the following classes:

A Student class that minimally stores the following data fields for a student:

-name

-student id number

-number of credits

-total grade points earned

The following methods should also be provided:

-A constructor that initializes the name and id fields

-A method that returns the student name field

-A method that returns the student ID field

-A method that determines if two student objects arc equal if their student id numbers are the same (override equals from the class Object)

-Methods to set and retrieve the total number of credits

- Methods to set and retrieve the total number of grade points earned

- A method that returns the GPA (grade points divided by credits)

An instructor class that minimally stores the following data fields for an instructor:

-name

-faculty id number

-department

The following methods should also be provided:

-  A constructor that initializes the name and id fields

- Methods to set and retrieve the instructor's department

A course, class that minimally stores the following data for a course:

- name of the course

- course registration code

- maximum number )f 35 students

- instructor

- number of students

- students registered in the course (an array)

The following methods should also be provided:

- A constructor that initializes the name, registration code, and maximum number of students

- Methods to set and retrieve the instructor

- A method to search for a student in the course; the search should be based on an ID number.

- A method to add a student to the course. If the course is full, then an exception with an appropriate message should be raised (try creating your n exception class for this). Also, be sure that the student is not already registered in the course. The list of students should be in the order that they registered.

- A method to remove a student from the course. If the student is not found, then an exception with an appropriate message should be raised (use the same exception class mentioned above).

- A method that will allow Course objects to be output to a file using object serialization.

- A method that will allow Course objects to be read in from a file created with Object serialization.

You will note that the Student and Instructor classes described above have some commonality. Create a Person class that captures this commonality and uses it as a base class for Student and Instructor. This class should be responsible for the name and id fields and also provide a tostring method that returns a string of the form name, id. This will be the inherited tostring method for the Student and Instructor classes.

a. Draw a UML diagram for this application.

b. Implement the previous classes in Java. Write main program that can serve as a test class that tests all of the methods created and demonstrates that they are working.

c. Write a second main program that provides a menu to allow the user to

i. create a course, prompting the user for all of the course information,

ii. add students to the course,

iii. check to see if a student is registered in the course, and

iv. remove a student from the course.

d. Add to the previous menu the ability to save a course using object serialization. Also add a menu choice to read in a course from a file given the course code. Come up with a system of naming the file so that the user need only be asked the course code to load the course information from a file.

Reference no: EM13802398

Questions Cloud

Explain the role of critical thinking in business : In a 350 word essay explain the role of critical thinking in business. How does critical thinking differ from creative thinking. What role do personalities play in critical thinking.
Prepare a presentation about martin luther king : Prepare a Presentation about Martin Luther king.
What was challenging about the communication situation : How can large organizations' projects differ from small organizations' projects? How? Why? What was challenging about the communication situation?
Branches in different countries : In this assignment, you will identify a global organization with branches in different countries and select this company as your client organization.
Write main program that can serve as a test class : Implement the previous classes in Java. Write main program that can serve as a test class that tests all of the methods created and demonstrates that they are working
How do interest groups differ from political parties : What are the primary differences between the American two-party system and the multi-party systems found in many European countries. How do interest groups differ from political parties
Describe the foundations of homeland security : Describe the foundations of homeland security
How have you demonstrated leadership ability in your life : How have you demonstrated leadership ability in your life, work, or school? What special attribute(s) or accomplishment(s) sets you apart?
Company origin-history-corporate structure and growth : Investigate and analyze the company's origin, history, corporate structure and growth. Identify the strengths and weaknesses within the company in reference to their diversity initiatives

Reviews

Write a Review

Programming Languages Questions & Answers

  Program to help gymnasium help desk associate

Write a program that helps a gymnasium help desk associate to answer questions about membership cost. The rates are as follows.

  Design pseudocode for application to enter order item

Design the pseudocode for an application that allows a user to enter an order item continuously until a sentinel value is entered.

  Write driver class to instantiates-updates flight objects

Write a driver class called FlightTest whose main method instantiates and updates several Flight objects. Two classes are needed for this project: Flight and FlightTest.

  Find out a web site which describes the use of a selection

find a web site that explains the use of a selection structure or an iteration structure in programming. provide the

  Cooks selected by methods are different which one is taller

He orders the shortest man in each column to step aside and chooses the tallest of these twenty-five. The two cooks chosen by the two methods are different. Which one is taller?

  Write a program sequence that places the value in address

Write a program sequence that places the value in Address $1000 into Accumulator A and places the value in Address $1001 in Accumulator B. Then, add these values together and store the result in Location $1002.

  Determine seperate total of positive and negative numbers

Read set of 40 positive and negative numbers entered from keyboard and determine seperate total of positive and negative numbers. How to show modular design of above statement

  Create the logic for a program that accepts an annual salary

Create the logic for a program that accepts an annual salary as input pass the salary to a method that calculate the highest monthly housing payment the user can afford assuming that the year's total payment is no more than 25 percent of the annua..

  Program a robot to run mile-long steeplechase

Program a robot to run mile-long steeplechase where steeples are made from beepers instead of wall segmesnts. the robot must jumb the steeples in this race by picking the beepers that make up the steeples.

  Write program to read file consisting of students test score

Write program which reads a file consisting of students test scores in range 0-100. It muts then determine number of students having scores in each of the ranges.

  Write program which prompts user to enter length in feet

Create and execute the program for this exercise. Write down the program which prompts user to enter length in feet and inches and outputs equivalent length in centimeters.

  Design employee objects-display each object-s yearly salary

Design two employee objects and display each object's yearly salary. Then provide each employee 10% raise and display each Employee's yearly salary again.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd