Question
College Student You are going to write a program that accepts a student's courses and produces the appropriate bill (one course at a time). Example
College Student
You are going to write a program that accepts a student's courses and produces the appropriate bill (one course at a time). Example output is shown at the conclusion of these instructions.
To Do within the CollegeStudent.java file:
Complete the CollegeStudent class as follows:
Class Name: CollegeStudent
Static Variable: costPerHour = $125
Instance Variables:
-
name (String) - In the format
- Example: Smith, John
-
courseTitle (String)
- courseNumber (String)
- credits (int)
- courseFee (double)
Instance Methods:
- A default constructor
- A constructor that accepts arguments for name, courseTitle, credits, and courseNumber (use the same variable name for the parameter as the instance variables).
- courseFee should be set by multiplying credits and costPerHour.
- Accessor methods for each of the class fields
- Mutator methods for each of the class fields the mutator for courseFee should use the credits as a parameter and calculate the fee using the costPerHour (use credits as the parameter variable)
- toString() a method to display the fields of an instance of the class in an easy to read format(preferably on separate lines). Use this when referencing the instance variables.
To Do within the Main.java file
Complete the Main class to test your CollegeStudent class as follows:
- The main method should use a loop to accept user input until the user indicates there are no more inputs.
- When the user indicates that they have more input, you should call a static method to get the user inputs. This method should:
- Accept a CollegeStudent object as a parameter.
- Use a Scanner to prompt the user for the inputs First Name, Last Name (as one String), course title, course number, and number of credits.
- Use the mutator methods to set those values for the object.
- Return a CollegeStudent object.
- The main method should display the CollegeStudent object nicely formatted.
Testing your Program
Test the program by inputting some courses and confirming the output is correct and pleasing to the eye. Here is one example:
Enter the student name (last, first): John, Do Enter the course title: ELA
Enter the course number: 123 Enter the course number of credits: 2 Name: John, Do Course Title: ELA Course Number: 123 Credits: 4 Course Fee: $500 Would you like to input another? (Y or N)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started