Design a Ship class that has the following members:
• A member variable for the name of the ship (a string)
• A member variable for the year that the ship was built (a
string)
• A constructor and appropriate accessors and mutators
• A virtual print function that displays the ship’s name and the
year it was built.
Design a CruiseShip class that is derived from the Ship class.
The CruiseShip class
should have the following members:
• A member variable for the maximum number of passengers (an int
)
• A constructor and appropriate accessors and mutators
• A print function that overrides the print function in the base
class. The CruiseShip class’s print function should display only
the ship’s name and the maximum number of passengers.
Design a CargoShip class that is derived from the Ship class.
The CargoShip class
should have the following members:
• A member variable for the cargo capacity in tonnage (an int
).
• A constructor and appropriate accessors and mutators.
• A print function that overrides the print function in the base
class. The CargoShip class’s print function should display only the
ship’s name and the ship’s cargo capacity.
After you have created these classes, create a driver program that defines an array pointers to your abstract base class Ship. It should present a menu to allow the user to enter a Cruise Ship or a Cargo Ship. When the user selects cruise ship, it should prompt them for the name, year built, and the number of passengers. When the user selects cargo ship, it should prompt them ffor the name, year built, and the maxium cargo load (in tons). Each selection should create an object that can be stored into your array of pointers. When the program exits, it should display the history of the session which includes each of the objects the user created which will be a combination of cruise ships and cargo ships. An example output is shown here:
Menu
1. Cruise Ship
2. Cargo Ship
3. Quit
Please make your selection: 2
Please enter the name of the ship: Big Bertha
Please enter the year the ship was built: 1975
Please enter the capacity (tons): 50000
Menu
1. Cruise Ship
2. Cargo Ship
3. Quit
Please make your selection: 1
Please enter the name of the ship: Disney Magic
Please enter the year the ship was built: 1998
Please enter the capacity (passengers): 2400
Menu
1. Cruise Ship
2. Cargo Ship
3. Quit
Please make your selection: 3
The history of your session is
Selected Cargo Ship
Name: Big Bertha
Year: 1975
Capacity (tons): 50000
Selected Cruise Ship
Name: Disney Magic
Year: 1998
Capacity (passengers): 2400
In: Computer Science
please , im sorting by name, address, dependent and hours. i got a lot of errors i need help please. Thanks
package application;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
class Emprec {
String name;
String address;
double hours;
double rate;
int dependents;
char gender;
boolean degree;
// This is the classes's constructor !!!!
Emprec(String name, String address, String hours,String dependents) {
try {
this.name = name;
this.address = address;
this.hours = Double.valueOf(hours).doubleValue();
this.dependents = Integer.parseInt(dependents);
} catch (NumberFormatException errmsg) {
System.out.println("Invalid format" + errmsg);
this.name = "";
this.hours = 0.0;
}// catch
}// Emprec constructor !!!!
double calc_fed_tax(double hours, double rate) {
double yearly_income;
yearly_income = hours * rate * 52;
if (yearly_income < 30000.00)
return (hours * rate * .28);
else if (yearly_income < 50000.00)
return (hours * rate * .32);
else
return (hours * rate * .38);
}// calc_fed_tax
double calc_state_tax(double hours, double rate) {
double state_tax;
state_tax = hours * rate * .0561;
return (state_tax);
}// calc_state_tax
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String getAddress() {
return address;
}
public double getHours() {
return hours;
}
public int getDependents() {
return dependents;
}
public double getRate(){
return rate;
}
public char getGender(){
return gender;
}
public String toString() {
return ("\n Name: " + name +
"\n Address: " + address +
"\n Hours: " + hours+
"\n Dependents " + dependents);
}// toString
}// Emprec
public abstract class CompDemo3Sorts_Improved {
public abstract void main(String args[]);{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the fields to sort by");
String s=sc.next();
if(s=="name"){
String str[]=name.split(" ");
List<String> slist= new ArrayList<String>();
str=Arrays.asList(str);
List<String> sortedList=slist.stream().sorted().collect().(collector().toList());
sortedList.forEach(System.out.println());
}
if(s=="address"){
String str1[]=address.split(" ");
List<String> slist1= new ArrayList<String>();
str1=Arrays.asList(str1);
List<String> sortedList=slist1.stream().sorted().collect().(collector().toList());
sortedList.forEach(System.out.println());
}
if(s=="hours"){
String str2[]=hours.split(" ");
List<String> slist2= new ArrayList<String>();
str2=Arrays.asList(str2);
List<String> sortedList=slist2.stream().sorted().collect().(collector().toList());
sortedList.forEach(System.out.println());
}
if(s=="dependent"){
String str[]3=dependent.split(" ");
List<String> slist3= new ArrayList<String>();
str3=Arrays.asList(str3);
List<String> sortedList=slist3.stream().sorted().collect().(collector().toList());
sortedList.forEach(System.out.println());
}
}}
In: Computer Science
Challenge: Dog
Description: Create a Dog class that contains specified properties and methods. Create an instance of Dog and use its methods.
Purpose: This application provides experience with creating classes and instances of objects in C#.
Requirements:
Project Name: Dog
Target Platform: Console
Programming Language: C#
Documentation:
Create a class called Dog.
Dog is to have the following public properties:
Gender is a enum type you need to create that contains Male and Female.
Create a constructor (Links to an external site.) in the class to initialize all of the properties when creating an instance.
Create a method (function in the class) called Bark that takes one parameter that is the number of times to bark and prints “Woof!” that many times to the Console.
Create a method called GetTag that takes no parameters and returns a string. The method returns “If lost, call [owner]. [‘Her’|‘His’] name is [name] and [‘she’|‘he’] is [age] [‘year’|‘years’] old.”
[owner] means replace with the name of the owner.
[‘Her’|‘His’] means choose to display “Her” or “His” based on the gender of the Dog.
[name] means replace with the name of the Dog.
[‘she’|‘he’] means choose to display “she” or “he” based on the gender of the Dog.
[‘year’|‘years’] means to choose to display “year” or “years” depending on the age of the Dog. If age is 1, use “year”. If any other age, use “years”.
In the Main function of the application, test that instances of Dog can be created and that the methods work. In the following, “Orion” is the name of the Dog instance, “Shawn” is the owner, 1 is the age, and Gender.Male is the gender.
Dog puppy = Dog("Orion", "Shawn", 1, Gender.Male); // create object instance
puppy.Bark(3); // output: Woof!Woof!Woof!
Console.WriteLine(puppy.GetTag()); // output: If lost, call Shawn. His name is Orion and he is 1 year old.
Dog myDog = Dog("Lileu", "Dale", 4, Gender.Female); // create object instance
myDog.Bark(1); // output: Woof!
Console.WriteLine(myDog.GetTag()); // output: If lost, call Dale. Her name is Lileu and she is 4 years old.
Submission
You are to submit a zip file of the project directory for the application you create. The entire project is to be submitted. Find the project folder that holds the Visual Studio project and zip it.
When you finish can you send pictures of the code with spacing
In: Computer Science
At the beginning of 2016, IASB issued a new standard (IFRS 16) on leasing accounting. Explain the reasons behind this decision and the impact on companies’ financial statements.
In: Accounting
In what ways was the Republican party fracturing before the 2016 election? Essentially, how do we know it was a highly factionalized party?
*This is all the information*
In: Economics
In: Finance
in dollars outstanding in 2016, the largest money market security was Multiple Choice commercial paper. banker's acceptances. T-bills. Fed funds and repos.
In: Finance
What is Situational Analysis: brief description of current situation, including what the managers believe are the key issues. on Pandera Bread Company in 2016 Casebook.
In: Operations Management
Suppose a dairy farmer obtained a $100,000 loan to buy creamery equipment on June 1, 2016. There was no down payment, and the loan is payable over 5 years in equal payments of $20,000 due on June 1st each year (first payment June 1, 2017), with the remaining balance due at the end of the loan term. The annual interest rate is 5%.
Businesses often need to compute the amount of accrued interest payable as of the date of a financial statement, such as a balance sheet. Approximately how much accrued interest would this loan contribute to the dairy farmer’s year-end balance sheet for 2016?
In: Finance
Corporate Law
The company is prohibited from purchasing, dealing in or lending money on its own shares. Therefore, a company is prohibited from buying back its shares, which tantamount to giving priority to the member who is selling his shares, over the company's creditors and other members. This transaction will also result in the reduction of the company's capital.
Based on the statement above critically discuss exceptions to
the prohibition of share buy-back as provided under the Companies
Act 2016. Support your answer with relevant statutory provisions of
the Companies Act 2016 and decided cases.
Thanks advanced.
In: Operations Management