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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

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

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