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

  Create a project in xcode

Create a new project in XCode using the Mac OS X/Command Line Tool template

  Develop a unit converter to convert both force

Decided on a topic requiring a computer application that includes Excel programming features. Begin the layout and basic structure of the project in class today by laying out tables, equations, user input and output. Try to complete the brainstorm..

  Create class to include fields for length-width in inches

Create a class name Tape that includes fields for length and width in inches and properties for each field. Also include a ToString () method that returns a string constructed from the return value

  Write a program use at least one user-defined function

program must use at least one user-defined function (main does not count). You must define the function and actually use it in your program.

  Write a driver program to test class

Create a class called Rational for performing arithmetic with fractions. Write a driver program to test your class. Use integer variables to represent the private instance variables of the class-the numerator and the denominator.

  Design getter and setter and constructor methods

User must have option to draw new shape at different location and keep the existing shape. Design all the getter and setter & constructor methods for each class.

  Determine the total resistance of a number of resistors

Prepare a function that will determine the total resistance of a number of resistors that are connected in parallel.

  Program that prompts the user to enter the mass of a person

Write a program that prompts the user to enter the mass of a person in kilograms and outputs the equivalent weight in pounds.

  Design a benefits election system

Individual project for this course is in form of Service Request from Huffman Trucking. It is essential for student to access Service Request: SR-ht-001. Design a Benefits Election System.

  Provide an analogous response when adding the two positive

What is the range of values that the multiplication of those two numbers (a ? b) will have - Provide an analogous response when adding the two positive n-bit and m-bit numbers (a + b).

  Write program to compute and outputs the average gpa

Write a program that computes and outputs the average GPA for both female and male students. Format your results to two decimal places. Your program should use the functions.

  Void function to display in nicely formated way

Write a void function display_exer() that display in a nicely formated way the eat members of an exerclass object. Pass the object to the function by reference.

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