Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

At Springfield State U there are two classes of students: on-campus students and online students. On-campus students are categorized as residents (R) or nonresidents (N) depending on whether they reside within the state in which Springfield exists or they reside in a different state. The base tuition for on-campus students is $5500 for residents and $12,200 for non-residents. Some on-campus students, enrolled in certain pre-professional programs, are charged an additional program fee which varies depending on the program. An on-campus students may enroll for up to 18 credit hours at the base rate but for each credit hour exceeding 18, they pay an additional fee of $350 for each credit hour over 18.

Online students are neither residents nor non-residents. Rather, their tuition is computed as the number of credit hours for which they are enrolled multiplied by the online credit hour rate which is $875 per credit hours. Furthermore, some online students enrolled in certain degree programs pay an online technology fee of $125 per semester.
4 Software Requirements
Your program shall meet these requirements.
1. Student information for Springfield State University is stored in a text file named p02-students.txt. There is one student record per line, where the format of a student record for an on-campus student is:
C id last-name first-name residency program-fee credits where:
'C'
id last-name first-name residency program-fee credits
Identifies the student as an on-campus student.
The student identifier number. A string of 13 digits.
The student's last name. A contiguous string of characters.
The student's first name. A contiguous string of characters.
'R' if the student is a resident, 'N' if the student is a non-resident. A program fee, which may be zero.
The number of credit hours for which the student is enrolled.
The format of a student record for an online student is:
O id last-name first-name tech-fee credits
where 'O' identifies the student as an online student, and id, last-name, first-name, and credits are the same as for an on-campus student. The tech-fee field is 'T' if the student is to be assessed the technology fee or '-' if the student is not assessed the technology fee.
Arizona State University Page 1
CSE205 Object Oriented Programming and Data Structures
Programming Project 2 :: 25 pts
Here is an example p02-students.txt file:
Sample p02-students.txt
C 8230123345450 Flintstone Fred R 0 12 C 3873472785863 Simpson Lisa N 750 18 C 4834324308675 Jetson George R 0 20
O 1384349045225 Szyslak Moe - 6
O 5627238253456 Flanders Ned T 3
The program shall read the contents of p02-students.txt and calculate the tuition for each student.
The program shall write the tuition results to an output file named p02-tuition.txt formatted thusly:
id last-name first-name tuition
id last-name first-name tuition
...

where tuition is the computed tuition for the student. The tuition shall be displayed with two digits after the decimal point. For example:
Sample p02-tuition.txt
1384349045225 Szyslak Moe 5250.00 3873472785863 Simpson Lisa 12950.00 4834324308675 Jetson George 6200.00 5627238253456 Flanders Ned 2750.00 8230123345450 Flintstone Fred 5500.00
The records in the output file shall be sorted in ascending order by id.
If the input file p02-students.txt cannot be opened for reading (because it does not exist) then display an error
message on the output window and immediately terminate the program, e.g.,
run program
Sorry, could not open 'p02-students.txt' for reading. Stopping.
5 Software Design
Refer to the UML class diagram in Section 5.7. Your program shall implement this design.
5.1 Main Class
A template for Main is included in the zip archive. The Main class shall contain the main() method which shall instantiate an object of the Main class and call run() on that object. Complete the code by reading the comments and implementing the pseudocode.
5.2 TuitionConstants Class
The complete TuitionConstants class is included in the zip archive. This class simply declares some public static constants that are used in other classes.
5.3 Sorter Class
We shall discuss sorting later in the course, so this code may not make perfect sense at this time. However, I have provided all of it for you.
The Sorter class contains a public method insertionSort() that can be called to sort a list of ArrayList. When sorting Students we need to be able to compare one Student A to anotherStudent B to determine if A is less than or greater than B. Since we are sorting by student id, we have the abstract Student class implement the Comparable interface and we define Student A to be less than Student B if the mId field of A is less than the mId field of B. This is how we sort the ArrayList list by student id.
Arizona State University Page 2
CSE205 Object Oriented Programming and Data Structures Programming Project 2 :: 25 pts
java.lang.Comparable is a generic interface (it requires a type parameter T to be specified when the interface is implemented) in the Java Class Library that declares one method:
int compareTo(T obj)
where T represents a class type and obj is an object of the class T. The method returns a negative integer ifthis T (the object on which the method is invoked) is less than obj, zero if this T and obj are equal, or a positive integer if this T is greater than obj. To make Student implement the Comparable interface, we write:
public abstract class Student implements Comparable { ... }
Since Student implements Comparable, whenever compareTo() is called in Sorter.keepMoving() to compare two objects, either OnCampusStudent.compareTo() or OnlineStudent.compareTo() will be called.
5.4 Student Class
The Student class is an abstract class that implements the java.lang.Comparable interface (see 5.3 Sorter Class):
public abstract class Student implements Comparable {
...
}
A Student object contains five instance variables:
mCredits Number of credit hours the student is enrolled for. mFname The student's first name.
mId The student's id number.
mLname The student's last name.
mTuititon The student's computed tuition.
Most of the Student instance methods should be straightforward to implement so we will only mention the two that are
not so obvious:
+calcTuition(): void
An abstract method that is implemented by subclasses of Student. Abstract methods do not have to be implements, and this one is not.
+compareTo(pStudent: Student): int <>
Implements the compareTo() method of the Comparable interface. Returns -1 if the mId instance variable of this Student is less than the mId instance variable of pStudent. Returns 0 if they are equal (should not happen because id numbers are unique). Returns 1 if the mId instance variable of this Studentis greater than the mId instance variable of pStudent. The code is for compareTo() is:
return getId().compareTo(pStudent.getId());
5.5 OnCampusStudent Class
The OnCampusStudent class is a direct subclass of Student. It adds new instance variables that are specific to on-campus students:
mResident True if the OnCampusStudent is a resident, false for non-resident.
mProgramFee Certain OnCampusStudent's pay an additional program fee. This value may be 0.
The OnCampusStudent instance methods are mostly straightforward to implement so we shall only discuss two of them. +OnCampusStudent(pId: String, pFname: String, pLname: String): <>
Must call the superclass constructor passing pId, pFname, and pLname as parameters.
Arizona State University Page 3
CSE205 Object Oriented Programming and Data Structures Programming Project 2 :: 25 pts
+calcTuition(): void <>
Must implement the rules described in Section 3 Background. Note that we cannot directly access themTuition instance variable of an OnCampus Student because it is declared as private in Student. So how do we write to mTuition? By calling the protected setTuition() method that is inherited from Student. The pseudocode for calcTuition() is:
Override Method calcTuititon() Returns Nothing
Declare double variable t
If getResidency() returns true Then
t = TuitionConstants.ONCAMP_RES_BASE
Else
t = TuitionConstants.ONCAMP_NONRES_BASE
End if
t = t + getProgramFee();
If getCredits() > TuitionConstants.MAX_CREDITS Then
t = t + (getCredits() - TuitionConstants.MAX_CREDITS) × TuitionConstants.ONCAMP_ADD_CREDITS
End if
Call setTuition(t)
End Method calcTuition()
5.6 OnlineStudent Class
The OnlineStudent class is a direct subclass of Student. It adds a new instance variable that is specific to online students: mTechFee Certain OnlineStudent's pay an additional technology fee. This instance variable will be true if the
technology fee applies and false if it does not.
The OnlineStudent instance methods are mostly straightforward to implement so we shall only discuss two of them.
+OnlineStudent(pId: String, pFname: String, pLname: String): <>
Must call the superclass constructor passing pId, pFname, and pLname as parameters.
+calcTuition(): void <>
Must implement the rules described in Section 3 Background. Note that we cannot directly access themTuition instance variable of an OnlineStudent because it is declared as private in Student. So how do we write to mTuition? By calling the protected setTuition() method that is inherited from Student. The pseudocode for calcTuition() is:
Override Method calcTuititon() Returns Nothing
Declare double variable t = getCredits() × TuitionConstants.ONLINE_CREDIT_RATE
If getTechFee() returns true Then
t = t + TuitionConstants.ONLINE_TECH_FEE
End if
Call setTuition(t)
End Method calcTuition()
Arizona State University
Page 4
CSE205 Object Oriented Programming and Data Structures Programming Project 2 :: 25 pts
5.7 UML Class Diagram
The UML class diagram shown below was created using UMLet. See the zip archive for the UMLet file. We have these relationships:
Arizona State University Page 5
CSE205 Object Oriented Programming and Data Structures Programming Project 2 :: 25 pts
6 Additional Project Requirements
Format your code neatly. Use proper indentation and spacing. Study the examples in the book and the examples the instructor presents in the lectures and posts on the course website.
Put a comment header block at the top of each method formatted thusly:
/**
* A brief description of what the method does. */
Put a comment header block at the top of each source code file formatted thusly:
//******************************************************************************************************** // CLASS: classname (classname.java)
//
// DESCRIPTION
// A description of the contents of this file.
//
// COURSE AND PROJECT INFO
// CSE205 Object Oriented Programming and Data Structures, semester and year // Project Number:project-number
//
// AUTHOR
// your-name (your-email-addr) //********************************************************************************************************

Java, Programming

  • Category:- Java
  • Reference No.:- M92408088
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Java

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As