Hi, please read the entire problem.
I need help with the BusOrder class and test for it.
In Java you will require the use of loops and decisions for the following scenario:
Pretty Vehicles (PV) is a vehicle company that makes four different types of vehicles: cars, buses, motorcycles, and vans.
Their management team got together and decided that you start working on a more serious software for their most profitable vehicles first - Cars and Busses.
Your job now is to build the order classes for the two vehicle types, document them with Javadoc and write test classes for both classes you create.
BusOrder
As stated in the CarOrder requirements, the payment process is different for different vehicles. The main difference is that usually busses are bought by cities/companies in bulk, and cars are mostly bought in a one-car-per-customer fashion. The benefit of buying in bulk is that the buyer gets a discount on the total price of the busses they buy, and the more busses they buy, the bigger the discount.
Also, cities, counties and other government bodies usually get an extra discount on top of the first bulk discounted price.
For the calculations to be made, we first need an invoice, or an order. The order method, which is the constructor in our case (described in detail below), will set some variables in the instance of the BusOrder object, such as quantity, buyer, whether they are a government buyer or not, etc.. It will also call some methods to set some variables based on calculations made for the discount percentage and price per bus.
Once a bus order is made, Pretty Vehicles wants to be able to print a schedule as to when the busses are going to be built and finished, and how many per month they are going to build. The way they decide the schedule is based on how many vehicles the buyer is buying. A buyer that buys more vehicles is going to have more priority, and by that we mean more buses per month will be built for them.
With all that in mind, here are the requirements your manager compiled:
Code with sample output
public class Order {
int quantity;
String model;
int modelYear;
String buyerName;
boolean governmentBody;
int loanLengthYears;
double discountPercent;
double pricePerBus;
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public int getModelYear() {
return modelYear;
}
public void setModelYear(int modelYear) {
this.modelYear = modelYear;
}
public String getBuyerName() {
return buyerName;
}
public void setBuyerName(String buyerName) {
this.buyerName = buyerName;
}
public boolean isGovernmentBody() {
return governmentBody;
}
public void setGovernmentBody(boolean governmentBody)
{
this.governmentBody =
governmentBody;
}
public int getLoanLengthYears() {
return loanLengthYears;
}
public void setLoanLengthYears(int loanLengthYears)
{
this.loanLengthYears =
loanLengthYears;
}
public Order(int quantity, String model, int
modelYear, String buyerName, boolean governmentBody,
int
loanLengthYears) {
super();
this.quantity = quantity;
this.model = model;
this.modelYear = modelYear;
this.buyerName = buyerName;
this.governmentBody =
governmentBody;
this.loanLengthYears =
loanLengthYears;
this.calculateDiscountPercent();
this.calculatePricePerBus();
}
void calculateDiscountPercent(){
double discount=0;
if(this.governmentBody ==
true)
discount
=5;
if(this.modelYear <2016)
discount+=3;
if(this.quantity>=10 &&
this.quantity <=50)
discount+=5;
else if(this.quantity>50)
discount
+=10;
this.setDiscountPercent(discount/100);
}
void calculatePricePerBus(){
if(this.model.equals("Mad
Max")){
if(this.modelYear>=2016 && this.modelYear<=2019
)
this.setPricePerBus(80000);
else
if(this.modelYear>=2013 && this.modelYear<=2015
)
this.setPricePerBus(60000);
else
if(this.modelYear>=2010 && this.modelYear<=2012
)
this.setPricePerBus(45000);
}
else if(this.model.equals("Low
Emission")){
if(this.modelYear>=2016 && this.modelYear<=2019
)
this.setPricePerBus(95000);
else
if(this.modelYear>=2013 && this.modelYear<=2015
)
this.setPricePerBus(80000);
else
if(this.modelYear>=2010 && this.modelYear<=2012
)
this.setPricePerBus(65000);
}
else if(this.model.equals("No
oil")){
if(this.modelYear>=2016 &&
this.modelYear<=2019 )
this.setPricePerBus(110000);
else if(this.modelYear>=2013 &&
this.modelYear<=2015 )
this.setPricePerBus(95000);
else if(this.modelYear>=2010 &&
this.modelYear<=2012 )
this.setPricePerBus(80000);
}
else
System.out.println("Model does mot
exist");
}
public double getDiscountPercent() {
return discountPercent;
}
public void setDiscountPercent(double discountPercent)
{
this.discountPercent =
discountPercent;
}
public double getPricePerBus() {
return pricePerBus;
}
public void setPricePerBus(double pricePerBus) {
this.pricePerBus =
pricePerBus;
}
void printBuildingSchedule(){
//check how many buses a
month
int perMonth=0;
if(this.quantity<10)
perMonth =
4;
else if(this.quantity>=10
&& this.quantity <=50)
perMonth =
6;
else if(this.quantity>50)
perMonth =
8;
int qty = this.quantity;
//logic for display keep looping if
qty becomes less than permonth it's the last iteration
int i=1;
while(true){
System.out.println("Month "+i+ "-"+perMonth +" buses");
qty
-=perMonth;
i++;
if(qty<=perMonth){
System.out.println("Month "+i+ "-"+qty +"
buses");break;}
}
}
void printPaymentSchedule(){
double total = this.quantity *
pricePerBus * discountPercent;
double interest;
int perMonth=0;
if(this.governmentBody==true)
interest
=0;
else
interest = total
* 0.01 * this.loanLengthYears;
//System.out.println(this.discountPercent+ "
"+this.pricePerBus);
if(this.quantity<10)
perMonth =
4;
else if(this.quantity>=10
&& this.quantity <=50)
perMonth =
6;
else if(this.quantity>50)
perMonth =
8;
int qty=this.quantity;
int i=1;
while(true){
System.out.println("Month "+i+ "- $"+interest);
qty
-=perMonth;
i++;
if(qty<=perMonth){
System.out.println("Month "+i+ "-
$"+interest);break;}
}
}
public static void main(String[] args){
Order ord = new Order(25, "Low
Emission",
2013, "Lucy", false,
23);
ord.printBuildingSchedule();
ord.printPaymentSchedule();
}
}
Output
Hi, please read the entire problem. I need help with the BusOrder class and test for...
6-1 Test and debug the Invoice Application i need help with this please.. all help is appreciated Source code Java: import java.util.Scanner; import java.text.NumberFormat; public class InvoiceApp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String choice = "y"; while (!choice.equalsIgnoreCase("n")) { // get the input from the user System.out.print("Enter customer type (r/c): "); String customerType = sc.next(); System.out.print("Enter subtotal: "); double subtotal = sc.nextDouble(); // get the discount percent double discountPercent = 0.0; switch(customerType) {...
i need help working out the problem and entering it into excel Background: On January 1, 2020, the company has purchased a 14 year $100,000 bonds investment. The bond calls for an annual payment of interest on 12/31 at a contractual (stated) rate of 6%. Given the credit standing of the issuing company, an interest rate of 8.25% has been imputed as the effective rate. The principal amount of the bond is due at maturity. The company classified this bond...
Hi there, I have problem-solving this question, would definitely need help to explain if we need to look for the taxable income portion: Question: Topless:- A sporty convertible with a cost of $100,000 and a useful life of 5 years. It will produce rental income of $60,000 per year and operating costs of $10,000 per year. A major service is required after 3 years costing $15,000. A salvage value of $25,000 is expected after 5 Years. The required return is...
** Please read the bold statement after the question, I have the answers, but I need to make sure they are correct. Thanks** #1 Using a spreadsheet application, create an amortization schedule for a 30 year, fixed rate (4.58%) $200k loan. Answer the following: what is the monthly payment? how much total interest will you pay? Print out enough of your spreadsheet to defend your work and answers. Assume that you took the loan in #1 and paid your monthly...
1. Regression is always a superior forecasting method to exponential smoothing, so regression should be used whenever the appropriate software is available. (Points :1)TrueFalse2. Time-series models rely on judgment in an attempt to incorporate qualitative or subjective factors into the forecasting model. (Points : 1)TrueFalse3. A trend-projection forecasting method is a causal forecasting method. (Points : 1)TrueFalse4. Qualitative models attempt to incorporate judgmental or subjective factors into the forecasting model. (Points : 1)TrueFalse5. The naive forecast for the next period...
hi..please help..so i took a test and i got all of it wrong and im not sure how to do this problems..this is Investment class..please explain every step because im going to study using this material.thank you Fall 2010 4. Compare and contrast open end ve closed-end mutual funds will sell as long you want to buy the share, management comparin thom to you, while closed end mutual funds Preferred stocks on any public traced securities such as cquity, bond...
I need help on question 2. MODULE IV: TIME VALUE OF MONEY INTRODUCTION The time value of money analysis has many a lysis has many applications, ranging from setting hedules for paying off loans to decisions about whether to invest in a partie financial instrument. First, let's define the following notations: I = the interest rate per period Na the total number of payment periods in an annuity PMT = the annuity payment made each period PV = present value...
I need help recording the following adjusting entries in the General Journal. Adjusting journal Entries. Adj-1 Dec. 31 The company has $1,800 of supplies left at month end. Adj-2 Dec. 31 Record the portion of the Prepaid Insurance used in December. Adj-3 Dec. 31 Record one month of depreciation for the building purchased on December 1st. Adj-4 Dec. 31 Employees earned $1,200 in salaries the last week in December that will be paid on January 10th of next year. Adj-5...
please help me answer these questions, I provided all the information. thank you You are the financial analyst of the Management and Budgeting Oftice (MBO) for the Procurement Agency of your Municipality The Transport system of your city needs to have an extension/renovation of the existing equipment (eg vehicles, on-board Wi-Fi network, etc.) and infrastructure (e.g. binary for bus, etc). The transport system is totally owned by the municipality, hence it is in charge of investment decision and business activity...
NEED HELP WITH THIS PROBLEMS!!!! There all together please read the information! Comprehensive Problem 3 Part 4: Note: You must complete parts 1, 2, and 3 before completing part 4 of this comprehensive problem. Based on the following selected data, journalize the adjusting entries as of December 31 of the current year. If no entry is required, select "No entry required" from the dropdown and leave the amount boxes blank. If an amount box does not require an entry, leave...