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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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