Write an enhanced for loop that iterates over each student

Assignment Help JAVA Programming
Reference no: EM131018072

I have bene unable to complete the following project and need help to complet it.

//***********************************************

// CLASS: Main

//

// DESCRIPTION

// The Main class for Project 2.

//

// AUTHOR

// Kevin R. Burger ([email protected])

// Computer Science & Engineering

// School of Computing, Informatics, and Decision Systems Engineering

// Fulton Schools of Engineering

// Arizona State University, Tempe, AZ 85287-8809

// Web: https://www.devlang.com

//**************************************************

import java.io.File;

import java.io.FileNotFoundException;

import java.io.PrintWriter;

import java.util.ArrayList;

import java.util.Scanner;
public class Main {
/**

* Instantiate a Main object and call run() on the object.

*/

public static void main(String[] args) {

???

}
/**

* Calculates the tuition for each student. Write an enhanced for loop that iterates over each Student in

* pStudentList. For each Student, call calcTuition() on that Student. Note: this is a polymorphic method

* call.

*

* PSEUDOCODE

* EnhancedFor each student in pStudentList Do

* student.calcTuition()

* End EnhancedFor

*/

private void calcTuition(ArrayList<Student> pStudentList) {

???

}
/**

* Reads the student information from "p02-students.txt" and returns the list of students as an ArrayList

* <Student> object.

*

* PSEUDOCODE

* Declare and create an ArrayList<Student> object named studentList.

* Open "p02-students.txt" for reading using a Scanner object named in.

* While in.hasNext() returns true Do

* String studentType <- read next string from in

* If studentType is "C" Then

* studentList.add(readOnCampusStudent(in))

* Else

* studentList.add(readOnlineStudent(in))

* End If

* End While

* Close the scanner

* Return studentList

*/

private ArrayList<Student> readFile() throws FileNotFoundException {

???

}
/**

* Reads the information for an on-campus student.

*

* PSEUDOCODE

* Declare String object id and assign pIn.next() to id

* Declare String object named lname and assign pIn.next() to lname

* Declare String object named fname and assign pIn.next() to fname

* Declare and create an OnCampusStudent object. Pass id, fname, and lname as params to ctor.

* Declare String object named res and assign pIn.next() to res

* Declare double variable named fee and assign pIn.nextDouble() to fee

* Declare int variable named credits and assign pIn.nextInt() to credits

* If res.equals("R") Then

* Call setResidency(true) on student

* Else

* Call setResidency(false) on student

* End If

* Call setProgramFee(fee) on student

* Call setCredits(credits) on student

* Return student

*/

private OnCampusStudent readOnCampusStudent(Scanner pIn) {

???

}
/**

* Reads the information for an online student.

*

* PSEUDOCODE

* Declare String object id and assign pIn.next() to id

* Declare String object named lname and assign pIn.next() to lname

* Declare String object named fname and assign pIn.next() to fname

* Declare and create an OnlineStudent object. Pass id, fname, lname as params to the ctor.,

* Declare String object named fee and assign pIn.next() to fee

* Declare int variable named credits and assign pIn.nextInt() to credits

* If fee.equals("T")) Then

* Call setTechFee(true) on student

* Else

* Call setTechFee(false) on student

* End If

* Call setCredits(credits) on student

* Return student

*/

private OnlineStudent readOnlineStudent(Scanner pIn) {

???

}
/**

* Calls other methods to implement the sw requirements.

*

* PSEUDOCODE

* Declare ArrayList<Student> object named studentList

* try

* studentList = readFile()

* calcTuition(studentList)

* Call Sorter.insertionSort(studentList, Sorter.SORT_ASCENDING) to sort the list

* writeFile(studentList)

* catch FileNotFoundException

* Print "Sorry, could not open 'p02-students.txt' for reading. Stopping."

* Call System.exit(-1)

*/

private void run() {

???

}
/**

* Writes the output file to "p02-tuition.txt" per the software requirements.

*

* PSEUDOCODE

* Declare and create a PrintWriter object named out. Open "p02-tuition.txt" for writing.

* EnhancedFor each student in pStudentList Do

* out.print(student id + " " + student last name + " " + student first name)

* out.printf("%.2f%n" student tuition)

* End EnhancedFor

* Close the output file

*/

private void writeFile(ArrayList<Student> pStudentList) throws FileNotFoundException {

???

}

}

 

//**************************************************************************************************************

// CLASS: Sorter

//

// DESCRIPTION

// Implements the insertion sort algorithm to sort an ArrayList<> of Students.

//

// AUTHOR

// Kevin R. Burger ([email protected])

// Computer Science & Engineering Program

// Fulton Schools of Engineering

// Arizona State University, Tempe, AZ 85287-8809

// http:www.devlang.com

//**************************************************************************************************************

package tuition;
import java.util.ArrayList;
public class Sorter {
public static final int SORT_ASCENDING = 0;

public static final int SORT_DESCENDING = 1;
/**

* Sorts pList into ascending (pOrder = SORT_ASCENDING) or descending (pOrder = SORT_DESCENDING) order

* using the insertion sort algorithm.

*/

public static void insertionSort(ArrayList<Student> pList, int pOrder) {

for (int i = 1; i < pList.size(); ++i) {

for (int j = i; keepMoving(pList, j, pOrder); --j) {

swap(pList, j, j - 1);

}

}

}
/**

* Returns true if we need to continue moving the element at pIndex until it reaches its proper location.

*/

private static boolean keepMoving(ArrayList<Student> pList, int pIndex, int pOrder) {

if (pIndex < 1) return false;

Student after = pList.get(pIndex);

Student before = pList.get(pIndex - 1);

return (pOrder == SORT_ASCENDING) ? after.compareTo(before) < 0 : after.compareTo(before) > 0;

}
/**

* Swaps the elements in pList at pIndex1 and pIndex2.

*/

private static void swap(ArrayList<Student> pList, int pIndex1, int pIndex2) {

Student temp = pList.get(pIndex1);

pList.set(pIndex1, pList.get(pIndex2));

pList.set(pIndex2, temp);

}
}

//**************************************************************************************************************

// CLASS: TuitionConstants

//

// DESCRIPTION

// Constants that are used in calculating the tuition for on-campus and online students. Use these constants

// in the OnCampusStudent and OnlineStudent classes.

//

// AUTHOR

// Kevin R. Burger ([email protected])

// Computer Science & Engineering

// School of Computing, Informatics, and Decision Systems Engineering

// Fulton Schools of Engineering

// Arizona State University, Tempe, AZ 85287-8809

// Web: https://www.devlang.com

//**************************************************************************************************************

package tuition;
public class TuitionConstants {
public static final int ONCAMP_ADD_CREDITS = 350;

public static final int MAX_CREDITS = 18;

public static final int ONCAMP_NONRES_BASE = 12200;

public static final int ONCAMP_RES_BASE = 5500;

public static final int ONLINE_CREDIT_RATE = 875;

public static final int ONLINE_TECH_FEE = 125;
}

Reference no: EM131018072

Questions Cloud

Write an equation for jason production possibility frontier : Given the above information, write an equation for Jason's production possibility frontier in slope intercept form where jam (J) is measured on the vertical axis and butter (B) is measured on the horizontal axis
Transistors that realize the current sources : For the folded-cascode differential amplifier of Fig. 9.38, find the value of VBIAS that results in the largest possible positive output swing, while keeping Q3: Q4: and the pnp transistors that realize the current sources out of saturation.
What is the equation for this new line : Suppose you are given the following equation: X = 2Y - 4. where X is the variable measured on the horizontal axis and Y is the variable measured on the vertical axis. Suppose that something happens so that for every X value in the original equation..
Create an analysis report : The details of open, axial, and selective coding data analysis procedures related to interview question responses.Direct quotes and in-text reference support for all factual statements.
Write an enhanced for loop that iterates over each student : Calculates the tuition for each student. Write an enhanced for loop that iterates over each Student in. pStudentList. For each Student, call calcTuition() on that Student. Note: this is a polymorphic method
Bipolar differential amplifier : A bipolar differential amplifier having a simple pnp current-mirror load is found to have an input offset voltage of 2 mV. If the offset is attributable entirely to the finite β of the pnp transistors, what must βP be?
How did this week''s definition of leadership resonate : How could the poor leaders you have worked with in the past (or present) have done a better job?
Open-circuit differential gain : A current-mirror-loaded NMOS differential amplifier is fabricated in a technology for which |V1A |= 5 V/μm. All the transistors have L =0.5 μm. If the differential-pair transistors are operated at VOV = 0.25 V, what open-circuit differential gain..
Large-signal analysis and compare results : Use small-signal analysis to find the input voltage that would restore current balance to the differential pair. Repeat using large-signal analysis and compare results.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Classes using set and get methods

Create a java program that contains two classes using set and get methods. I need the program to return the area and perimeter of a rectangle. I wrote a program and he returned to me saying I used the wrong constructors and didn't create a the sec..

  Write a java applet for grade of gas in costco gas station

Write a java applet (not a java application program) for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use.

  Algorithm analysis with advanced data structures

Write a program to help the merchants devise a sequence of transmutations that would change silver into gold with the smallest possible total fee paid to the alchemists.

  Prints out a summary for a list of prescriptions

Create a class that prints out a summary for a list of prescriptions. Using your Prescription class and some if statements you will read in 3 prescriptions and print out an appropriate summary with a list of the prescriptions

  Write a program which adds two matrices

Write a program which adds two matrices together and displays the sum - Two arrays will contain user input, and the third array will be used to contain the sum of the two arrays.

  Write a program that establishes two savings accounts

Write a program that establishes two savings accounts with saver1 having account number 10002 with an initial balance of $2,000, and saver2 having account 10003 with an initial balance of $3,000

  Method that reflects overloading

Example of a method that reflects overloading, and one that reflects polymorphism

  Can a person who has a criminal conviction

Can a person who has a criminal conviction open a business as a sole trader?

  Write a point class that represents points on an x y axis

write a point class that represents points on an x y axis. the data members should be doubles x and y plus an int value

  User enters a list of car parts

So if the user enters a list of car parts, the programm holds this list. Afterward, when the user types in the name of the part the programm outputs that name from the list.

  Compute the daily wage of an employee

Write a JAVA program that will input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage of an employee. If the number of hours worked exceeds eight hours add 30% to each excess hours as overtime rate.

  Write an application bmicalc

Write an application (BMICalc) that reads the user's weight in poinds and height in inches, then calculates the Body Mass Index.

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