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;
}
}
-------CRUISE.JAVA--------
public class Cruise {
// Class Variables
private String cruiseName;
private String cruiseShipName;
private String departurePort;
private String destination;
private String returnPort;
// Constructor - default
Cruise() {
}
// Constructor - full
Cruise(String tCruiseName, String tShipName, String tDeparture,
String tDestination, String tReturn) {
cruiseName = tCruiseName;
cruiseShipName = tShipName;
departurePort = tDeparture;
destination = tDestination;
returnPort = tReturn;
}
// Accessors
public String getCruiseName() {
return cruiseName;
}
public String getCruiseShipName() {
return cruiseShipName;
}
public String getDeparturePort() {
return departurePort;
}
public String getDestination() {
return destination;
}
public String getReturnPort() {
return returnPort;
}
// Mutators
public void setCruiseName(String tVar) {
cruiseName = tVar;
}
public void setCruiseShipName(String tVar) {
cruiseShipName = tVar;
}
public void setDeparturePort(String tVar) {
departurePort = tVar;
}
public void setDestination(String tVar) {
destination = tVar;
}
public void setReturnPort(String tVar) {
returnPort = tVar;
}
// print cruise details
public void printCruiseDetails() {
// complete this method
}
// method added to print ship's name vice memory address
@Override
public String toString() {
return cruiseName;
}
}
In: Computer Science
ABC Co. lends DEF Co. $30,000 with 6% on October 1, 2019. The note is due on September 30, 2020. Both companies use December 31 as their fiscal year-end.
Please make all journal entries for ABC Co. assuming
a. The note is an interest bearing note
b. The note is a non-interest bearing note
Please make all journal entries for DEF Co. assuming
c. The note is an interest bearing note
d. The note is a non-interest bearing note
In: Accounting
ABC Co. lends DEF Co. $30,000 with 6% on October 1, 2019. The note is due on September 30, 2020. Both companies use December 31 as their fiscal year-end.
Please make all journal entries for ABC Co. assuming
a. The note is an interest bearing note
b. The note is a non-interest bearing note
Please make all journal entries for DEF Co. assuming
c. The note is an interest bearing note:
d. The note is a non-interest bearing note:
In: Accounting
1. A plane is initially 350 km away from Louisville in the direction 30.0◦ north of west traveling due south at a speed of 160 km/hr. Three hours later, the plane is 190 km due south of Louisville traveling at a speed of 150 km/hr in the direction 40.0◦ north of east.
(a) Draw the vector diagram you would use to calculate the average velocity. Make sure you label all your vectors and clearly indicate their direction.
(b) What is the average velocity (including magnitude and direction)?
(c) Draw the vector diagram you would use to calculate the average acceleration. Make sure you label all your vectors and clearly indicate their direction.
(d) What is the average acceleration (including magnitude and direction)?
In: Physics
Using Python create a script called create_notes_drs.py. In the file, define and call a function called main that does the following:
Bonus Challenge: Add a conditional statement to abort the script if the directory CyberSecurity-Notes already exists.
In: Computer Science
Great Life Co. commence business on October 1 of the current year. The following data summarized the operation at 100% of capacity during October results of Great Life Co.
|
Production |
1,000 units |
|
Sales ($120 per unit) |
800 units |
|
Ending Inventory |
200 units |
|
Total Cost of goods manufactured |
$62,500 |
|
Fixed manufacturing costs |
$35,000 |
|
Total Selling and Administrative expenses |
$15,000 |
|
Fixed Selling and Administrative expenses |
$6,000 |
Required:
|
(a) |
Prepare an income statement using absorption costing. |
|
(b) |
Prepare an income statement using variable costing. |
|
(c) |
Explain which one will best suit for the management decision |
In: Accounting
The Twisty Tie Dye Co. was formed and began operations in September 2017. The company sells one product; a fabulous, ultra soft plush poncho handmade from French cotton terry. All of the Twisty Tie Dye Co. sales are on account. Sixty percent of the credit sales are collected in the month of sale, 25% in the month following sale, and 10% in the second month following sale. The remainder are uncollectible. The following are budgeted sales data for the company for the first 4 months of operations:
| September | October | November | December | |
| Total Sales | $400,000 | $600,000 | $500,000 | $700,000 |
Cash receipts for the month of October and December are?
In: Accounting
Tiffany and Joe have just had a baby and are very
surprised to learn that their baby is albino with very pale skin
and hair color. Tiffany‘s sister has come to see the new baby, so
Joe goes out to talk with his sister Vicky. Joe is very angry. He
tells Vicky, "I think Tiffany had an affair with Frank! He’s the
only albino we know. Obviously, Tiffany and I aren't albino, so
Frank must be the father."
1. Luckily, Vicky remembers her high school biology, so she
explains, “Two parents with normal skin and hair color can have an
albino baby, if they are heterozygous and carry a recessive allele
for albinism.” She draws a Punnett Square to show this. Draw the
Punnett Square. Use A for the dominant allele that results
in normal skin and hair color and a for the recessive allele
that can result in very pale skin and hair color.
2. Joe is still mad and he doesn't understand Vicky's
explanation. He says "You aren't even speaking English! What does
heterozygous mean? What's a recessive allele? And what's the
connection between alleles and skin color?" Answer his
questions.
3. Joe says "Okay, I'm beginning to understand, but what are
zygotes? What's the connection between the zygotes in the Punnett
square and our baby?" Answer Joe's questions.
In: Biology
In: Accounting
1. Garr Co. issued $6,000,000 of 12%, 5-year
convertible bonds on December 1, 2020 for $6,025,480 plus accrued
interest. The bonds were dated April 1, 2020 with interest
payable
April 1 and October 1. Bond premium is amortized each interest
period on a straight-line basis. Garr Co. has a fiscal year end of
September 30.
On October 1, 2021, $3,000,000 of these bonds were converted into 42,000 shares of $15 par common stock. Accrued interest was paid in cash at the time of conversion.
In: Accounting