The Luxury Ocean Cruise Outings company has provided Global Rain with a software specification document that details a menu-driven software application. Other developers on your software development team have already begun this project by creating the Ship, Cruise, Passenger, and Driver classes. You will modify the classes by including attributes and their proper data structures, writing methods to perform required functionality and behavior, and making sure that your program performs input validation and exception handling.
--------DRIVER.JAVA---------
import java.util.ArrayList;
import java.util.Scanner;
import static java.lang.Integer.parseInt;
public class Driver {
// class variables (add more as needed)
private static ArrayList shipList = new ArrayList();
private static ArrayList cruiseList = new ArrayList();
private static ArrayList passengerList = new ArrayList();
public static void main(String[] args) {
initializeShipList(); // initial ships
initializeCruiseList(); // initial cruises
initializePassengerList(); // initial passengers
// add loop and code here that accepts and validates user
input
// and takes the appropriate action. include appropriate
// user feedback and redisplay the menu as needed
}
// hardcoded ship data for testing
// Initialize ship list
public static void initializeShipList() {
add("Candy Cane", 20, 40, 10, 60, true);
add("Peppermint Stick", 10, 20, 5, 40, true);
add("Bon Bon", 12, 18, 2, 24, false);
add("Candy Corn", 12, 18, 2, 24, false);
}
// hardcoded cruise data for testing
// Initialize cruise list
public static void initializeCruiseList() {
Cruise newCruise = new Cruise("Southern Swirl", "Candy Cane",
"Miami", "Cuba", "Miami");
cruiseList.add(newCruise);
}
// hardcoded cruise data for testing
// Initialize passenger list
public static void initializePassengerList() {
Passenger newPassenger1 = new Passenger("Neo Anderson", "Southern
Swirl", "STE");
passengerList.add(newPassenger1);
Passenger newPassenger2 = new Passenger("Trinity", "Southern
Swirl", "STE");
passengerList.add(newPassenger2);
Passenger newPassenger3 = new Passenger("Morpheus", "Southern
Swirl", "BAL");
passengerList.add(newPassenger3);
}
// custom method to add ships to the shipList ArrayList
public static void add(String tName, int tBalcony, int
tOceanView,
int tSuite, int tInterior, boolean tInService) {
Ship newShip = new Ship(tName, tBalcony, tOceanView, tSuite,
tInterior, tInService);
shipList.add(newShip);
}
public static void printShipList(String listType) {
// printShipList() method prints list of ships from the
// shipList ArrayList. There are three different outputs
// based on the listType String parameter:
// name - prints a list of ship names only
// active - prints a list of ship names that are "in service"
// full - prints tabbed data on all ships
if (shipList.size() < 1) {
System.out.println("\nThere are no ships to print.");
return;
}
if (listType == "name") {
System.out.println("\n\nSHIP LIST - Name");
for (int i = 0; i < shipList.size(); i++) {
System.out.println(shipList.get(i));
}
} else if (listType == "active") {
System.out.println("\n\nSHIP LIST - Active");
// complete this code block
}
} else if (listType == "full") {
System.out.println("\n\nSHIP LIST - Full");
System.out.println("-----------------------------------------------");
System.out.println(" Number of Rooms In");
System.out.print("SHIP NAME Bal OV Ste Int Service");
System.out.println("\n-----------------------------------------------");
for (Ship eachShip: shipList)
eachShip.printShipData();
} else
System.out.println("\n\nError: List type not defined.");
}
public static void printCruiseList(String listType) {
if (cruiseList.size() < 1) {
System.out.println("\nThere are no cruises to print.");
return;
}
if (listType == "list") {
System.out.println("\n\nCRUISE LIST");
for (int i=0; i < cruiseList.size(); i++) {
System.out.println(cruiseList.get(i));
}
} else if (listType == "details") {
System.out.println("\n\nCRUISE LIST - Details");
System.out.println("------------------------------------------------------------------------------------------");
System.out.println("
|----------------------PORTS-----------------------|");
System.out.print("CRUISE NAME SHIP NAME DEPARTURE DESTINATION
RETURN");
System.out.println("\n-----------------------------------------------------------------------------------------");
for (Cruise eachCruise: cruiseList)
eachCruise.printCruiseDetails();
} else
System.out.println("\n\nError: List type not defined.");
}
public static void printPassengerList() {
if (passengerList.size() < 1) {
System.out.println("\nThere are no passengers to print.");
return;
}
System.out.println("\n\nPASSENGER LIST");
System.out.println("-----------------------------------------------------");
System.out.print("PASSENGER NAME CRUISE ROOM TYPE");
System.out.println("\n-----------------------------------------------------");
for (Passenger eachPassenger: passengerList)
eachPassenger.printPassenger();
}
// display text-based menu
public static void displayMenu() {
System.out.println("\n\n");
System.out.println("\t\t\tLuxury Ocean Cruise Outings");
System.out.println("\t\t\t\t\tSystem Menu\n");
System.out.println("[1] Add Ship [A] Print Ship Names");
System.out.println("[2] Edit Ship [B] Print Ship In Service
List");
System.out.println("[3] Add Cruise [C] Print Ship Full
List");
System.out.println("[4] Edit Cruise [D] Print Cruise List");
System.out.println("[5] Add Passenger [E] Print Cruise
Details");
System.out.println("[6] Edit Passenger [F] Print Passenger
List");
System.out.println("[x] Exit System");
System.out.println("\nEnter a menu selection: ");
}
// Add a New Ship
public static void addShip() {
// complete this method
}
// Edit an existing ship
public static void editShip() {
// This method does not need to be completed
System.out.println("The \"Edit Ship\" feature is not yet
implemented.");
}
// Add a New Cruise
public static void addCruise() {
// complete this method
}
// Edit an existing cruise
public static void editCruise() {
// This method does not need to be completed
System.out.println("The \"Edit Cruise\" feature is not yet
implemented.");
}
// Add a New Passenger
public static void addPassenger() {
Scanner newPassengerInput = new Scanner(System.in);
System.out.println("Enter the new passenger's name: ");
String newPassengerName = newPassengerInput.nextLine();
// ensure new passenger name does not already exist
for (Passenger eachPassenger: passengerList) {
if
(eachPassenger.getPassengerName().equalsIgnoreCase(newPassengerName))
{
System.out.println("That passenger is already in the system.
Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// get cruise name for passenger
System.out.println("Enter cruise name: ");
String newCruiseName = newPassengerInput.nextLine();
// ensure cruise exists
for (Cruise eachCruise: cruiseList) {
if (eachCruise.getCruiseName().equalsIgnoreCase(newCruiseName))
{
// cruise does exist
} else {
System.out.println("That cruise does not exist in the system.
Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// get room type
System.out.println("Enter Room Type (BAL, OV, STE, or INT:
");
String room = newPassengerInput.nextLine();
// validate room type
if ((room.equalsIgnoreCase("BAL")) || (room.equalsIgnoreCase("OV"))
||
(room.equalsIgnoreCase("STE")) || (room.equalsIgnoreCase("INT")))
{
// validation passed - add passenger
Passenger newPassenger = new Passenger(newPassengerName,
newCruiseName, room.toUpperCase());
passengerList.add(newPassenger);
} else {
System.out.println("Invalid input. Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// Edit an existing passenger
public static void editPassenger() {
// This method does not need to be completed
System.out.println("The \"Edit Passenger\" feature is not yet
implemented.");
}
// Method to check if input is a number
public static boolean isANumber(String str) {
for (int i = 0; i < str.length(); i++) {
if (Character.isDigit(str.charAt(i)) == false)
return false;
}
return true;
}
}
----PASSENGER.JAVA------
public class Passenger {
// Class variables
private String passengerName;
private String passengerCruise;
private String passengerRoomType;
// Constructor - default
Passenger() {
}
// Constructor - full
Passenger(String pName, String pCruise,
String pRoomType) {
passengerName =
pName;
passengerCruise =
pCruise;
passengerRoomType =
pRoomType; // should be BAL, OV, STE, or INT
}
// Accessors
public String getPassengerName() {
return
passengerName;
}
public String getPassengerCruise()
{
return
passengerCruise;
}
public String getPassengerRoomType()
{
return
passengerRoomType;
}
// Mutators
public void setPassengerName(String tVar)
{
passengerName =
tVar;
}
public void setPassengerCruise(String
tVar) {
passengerCruise =
tVar;
}
public void setPassengerRoomType(String
tVar) {
passengerRoomType =
tVar;
}
// print method
public void printPassenger() {
int
spaceCount;
String spaces1 =
"";
String spaces2 =
"";
spaceCount = 20 -
passengerName.length();
for (int i = 1; i
<= spaceCount; i++) {
spaces1
= spaces1 + " ";
}
spaceCount = 20 -
passengerCruise.length();
for (int i = 1; i
<= spaceCount; i++) {
spaces2
= spaces2 + " ";
}
System.out.println(passengerName
+ spaces1 + passengerCruise + spaces2 +
passengerRoomType);
}
// method added to print passenger's
name vice memory address
@Override
public String toString() {
return
passengerName;
}
}
In: Computer Science
1. Using git commands and terminology, briefly explain how changes to files go from a working directory to a remote repository and from remote repository to the working directory. Answers that properly use git commands to explain how changes to files go from the working directory to the remote repository and vice versa.
2. In your own words, briefly explain the different git "places"
In: Computer Science
Methanol (CH3OH) is produced by reacting carbon monoxide (CO) and hydrogen (H2). A fresh feed stream containing CO and H2 joins a recycle stream and the combined stream is fed into a reactor. The reactor outlet stream flows at a rate of 350 mol/min and contains 10.6 wt% H2, 64.0 wt% CO, and 25.4 wt% CH3OH. The stream enters a cooler in which most of the methanol is condense. The liquid methanol is withdrawn as a product, and the gas stream leaving the condenser--which contains CO, H2, and 0.40 mole% uncondense CH3OH vapor is the recycle stream that combines with the fresh feed stream.
a. Draw the process flow diagram. Calculate the mole fraction of CH3OH, CO, and H2 present in the stream leaving the reactor.
b. Calculate the molar flowrate (moles/min) of condensed methanol stream and recycle stream.
c. Calculate the molar flowrate (moles/min) of CO and H2 present in the fresh feed.
d. What is the single-pass and overall conversion of CO?
In: Other
In 1984 and 1985, the small South American country of Bolivia experienced hyperinflation.
Do the money supply, price level, and exchange rate against the U.S. dollar move broadly as economic theory wouldpredict?
A. No, the three variables did not move in rigid lockstep as one would expect.
B. Yes, these three variables clearly moved in step, just as the theory would predict.
C. Not exactly, since the exchange rate went up while inflation the money supply also increased.
D. Bolivian data is too unreliable to assess in any meaningful way.
Between April 1984 and July 1985, the percent change in the general price level was approximately ____ %.
Between April 1984 and July 1985, the percent change in the price of the dollar was approximately ____ %.
How do these rates of increase compare to each other, and to the percent increase in the money supply?
A. All three rates of increase were very disparate.
B. Both increased at similar rates, and more slowly than the money supply.
C. Both increased at similar rates, and more rapidly than the money supply.
D. None of the above.
Can you explain the results regarding the percentage changes in these three variables? (Hint: Refer to the definition of the velocity of money.)
A. The results are consistent with an increase in the real demand for money, an effect that is correlated with exploding inflation, just as Bolivia experienced.
B. The results are consistent with a decline in the real demand for money, an effect that is correlated with exploding inflation, just as Bolivia experienced.
C. The results are unexplainable since the Bolivian experience was unprecedented.
D. The results are consistent with an increase in the real demand for money, which likely happened in Bolivia due to the surge in prices.
The Bolivian government introduced a dramatic stabilization plan near the end of August 1985. Looking at the price levels and exchange rates for the following two months, do you think it was successful?
A. Two months is an insufficient length of time to formulate an assessment.
B. No, the price level remained ridiculously high and the peso was still almost worthless relative to the dollar.
C. Yes, since both the price level and the exchange rate began to level off in the two months after August.
In light of your answer, explain why the money supply increased by a large amount between September and October 1985.
A. Seasonal factors such as fall harvesting explain the increase.
B. The increase was only large in absolute terms. In percentage terms, it was the second smallest month-over-month increase for 1985.
C. October was the start of a new Bolivian fiscal year.
D. The increase was probably a policy error by the Bolivian central bank.
In: Economics
Welfare Reform - what are your thoughts about what is proposed below 2?
In: Economics
How does Whole Genome Sequencing work? Why is Whole Genome Sequencing useful for tracking the spread of S. Aureus infections?
What is a 'clone' of S. aureus? Which clone is most common in the US, Canada, and South America?
What is an 'endemic' disease? What are 'reservoirs' of disease? Which reservoirs play the greatest role in spreading MRSA in households?
What are some ways MRSA may be spread through the household?
What was one method used to reduce the rate of home based S. aureus infections? How effective was it?
Which of the outstanding questions at the end of the paper would be most important to follow up on in your opinion?
In: Biology
Methanol is produced by reacting carbon monoxide and hydrogen. A fresh feed stream containing CO and H2 joins a recycle stream and the combined stream is fed to a reactor. The reactor outlet stream flows at a rate of 350 mole/min and contains 10.6 wt% H2 , 64 wt% CO and 25.4 wt% CH3OH. This stream enters a cooler in which most of the methanol is condensed. The liquid methanol condensate is withdrawn as a product, and the gas stream leaving the condenser – which contains CO, H2 and 0.4 mole % uncondensed CH3OH vapor – is the recycle stream that combines with the fresh feed. Determine a) the molar flow rates of CO and H2 in the fresh feed b) the production rate of liquid methanol (mol/min) and c) the molar flow rate of the recycle stream.
In: Other
Methanol is produced by reacting carbon monoxide and hydrogen. A fresh feed stream containing CO and H2 joins a recycle stream and the combined stream is fed to a reactor. The reactor outlet stream flows at a rate of 350 mole/min and contains 10.6 wt% H2, 64 wt% CO and 25.4 wt% CH3OH. This stream enters a cooler in which most of the methanol is condensed. The liquid methanol condensate is withdrawn as a product, and the gas stream leaving the condenser – which contains CO, H2 and 0.4 mole % uncondensed CH3OH vapor – is the recycle stream that combines with the fresh feed. Determine a) the molar flow rates of CO and H2 in the fresh feed b) the production rate of liquid methanol (mol/min) and c) the molar flow rate of the recycle stream.
In: Other
Meteorology: Storms Weather-wise magazine is published in association with the American Meteorological society. Volume 46, Number 6 has a rating system to classify Nor’easter storms that frequently hit New England states and can cause much damage near the ocean coast. A severe storm has an average peak wave height of 16.4 feet for waves hitting the shore. Suppose that a Nor’easter is in progress at the severe storm class rating.
(a) Let us say that we want to set up a statistical test to see if the wave action (i.e, height) is dying down or getting worse. What would be the null hypothesis regarding average wave height?
(b) If you wanted to test the hypothesis that the storm is getting worse, what would you use for the alternate hypothesis?
(c) If you wanted to test the hypothesis that the waves are dying down, what would you use for the alternate hypothesis?
(d) Suppose you do not know if the storm is getting worse or dying out. You just want to test the hypothesis that the average wave height is different (either higher or lower) from the severe storm class rating. What would you use for the alternate hypothesis?
(e) For each of the tests in parts (b), (c), and (d), would the area corresponding to the P-value be on the left, on the right, or on both sides of the mean?
In: Math
On July 1, 2016, S&S Inc. acquired 80% of Wade Co. by paying $596,000 cash. Wade Co. reported a Common Stock account balance of $160,000 and Retained Earnings of $360,000 at that date. S&S Inc.’s purchase was the best basis for determining the fair value of Wade Co. The total annual amortization as a result of this transaction was determined to be $12,000. Wade Co. realized net income of $104,000 evenly for the year in 2016 and made an annual dividend payment of $48,000 on October 1, 2016.
What is the non controlling interest share of Wade Co. net income for 2016? Show all work and computations in support of your answer.
Compute the noncontrolling interest in Wade Co. at December 31, 2016. SHOW ALL WORK IN SUPPORT OF YOUR ANSWER.
Using the information above, what is the book value of Wade Co. at the acquisition date?
In: Accounting