Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

TxVans sells minivans made by Toyota and Honda and has hired your team to develo

ID: 3866419 • Letter: T

Question

TxVans sells minivans made by Toyota and Honda and has hired your team to develop a Java application to manage its inventory. Each manufacturer offers several models of its minivan (e.g., LX, EX-L, SE, Touring). Each model comes with a standard set of equipment (e.g., the Honda Odyssey LX comes with wheels, seats, engine, radio, air conditioning, automatic transmission, airbags, rearview camera, usb audio interface, etc.). Minivans can have a variety of additional equipment or accessories (bluetooth, 3rd-row seat, smart entry, etc.), but not all accessories are available for all minivans (e.g., not all manufacturers offer a driver's side airbag). Some sets of accessories are sold as packages (e.g., the luxury package might include stereo, six speakers, cocktail bar, and twin overhead foxtails).

3. Write a Java Application that can increase the price of each package by $250, and retrieve a list of models and total price for each model for both manufacturers (20 points)

(4 points)

Explanation / Answer

import java.util.*;
import java.lang.*;

public class CarBuy
{
String[] details = new String[30];

float price=0F;
  
void funToyota()
{
price=1000.0F;
  
details[0]= "wheels";
details[1]= "seats";
details[2]= "engine";
details[3]= "radio";
details[4]= "air conditioning";
details[5]= "automatic transmission";
details[6]= "bluetooth";
details[7]= "rearview camera";
//details[8]= "usb audio interface";
/* details[0]=;
details[0]=;
details[0]=;
details[0]=;
details[0]=; */
}
  
void funHonda()
{
price=1200.0F;
  
details[0]= "wheels";
details[1]= "seats";
details[2]= "engine";
details[3]= "radio";
details[4]= "air conditioning";
details[5]= "automatic transmission";
details[6]= "airbags";
details[7]= "rearview camera";
details[8]= "usb audio interface";
/* details[0]=;
details[0]=;
details[0]=;
details[0]=;
details[0]=; */
System.out.println("len " +details.length);
}
  
void addOther()
{
Scanner sc= new Scanner(System.in);
int chc=0,cnt=0;
  
System.out.println("Accessorries sold here are : bluetooth, 3rd-row seat, smart entry,automatic transmission,rearview camera, object sensor, usb audio interface,stereo, six speakers, cocktail bar, twin overhead foxtails");
  
  
for (int i=details.length; i<30; i++, cnt++)
{
System.out.println("would you like to continue : 1-> Yes 2-> No");
chc= sc.nextInt();
  
System.out.println("Enter your choice accessorries:");
if ((cnt >1) && (chc==1))
details[i]=sc.next();
else if (cnt <1)
details[i]=sc.next();
else if ((cnt <1) && (chc==2))
break;

chc=0;
}
  
price+=(cnt*250);
}

  
void disp()
{
  
System.out.println(" ***** My Price List *****" );
System.out.println(" Price : " + price);
  
System.out.println(" ***** Features we will get in car *****");
for (int i=0; i<details.length; i++)
{
System.out.print(details[i]+" ");
  
}
  
}

  
public static void main(String []args)
{
System.out.println("---- Welcome to the Activity Zone ----");
CarBuy ob= new CarBuy();
  
System.out.println("Would you like to buy some other accessories with the car or only car");
System.out.println("Press 1: For TOYOTA car only Press 2:For TOYOTA car with accessories");
System.out.println("Press 3: For HONDA car only Press 4:For HONDA car with accessories");
  
Scanner sc= new Scanner(System.in);
int chc;
  
System.out.println("Enter your choice :");
chc= sc.nextInt();
  
switch(chc)
{
case 1: ob.funToyota(); ob.disp();
break;
case 2: ob.funToyota(); ob.addOther(); ob.disp();
break;   
case 3: ob.funHonda(); ob.disp();
break;
case 4: ob.funHonda(); ob.addOther(); ob.disp();
break;   

default: System.out.println("Press 1: For TOYOTA car only Press 2:For TOYOTA car with accessories");
System.out.println("Press 3: For HONDA car only Press 4:For HONDA car with accessories");
  

}
  
}
}

Output:

---- Welcome to the Activity Zone ----
Would you like to buy some other accessories with the car or only car
Press 1: For TOYOTA car only Press 2:For TOYOTA car with accessories
Press 3: For HONDA car only Press 4:For HONDA car with accessories
Enter your choice : 1

***** My Price List *****
Price : 1000.0
***** Features we will get in car *****
wheels seats engine radio air conditioning automatic transmission bluetooth rearview camera