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

Question 1. Please create a constructor to initial all fields for Car class give

ID: 3670748 • Letter: Q

Question

Question 1. Please create a constructor to initial all fields for Car class given below.

class Car {

          String licensePlate;

          double speed;       

          double maxSpeed;    

          //car is moving at the speed of "speed"

          void run() {

              System.out.println("Car " + licensePlate + "is moving at " + speed + "miles per hour.");

          }

}

Answer:

Question 2:

Question 11: (12 points)

Write a program for a zoo to calculate the fees the visitors need to pay. Assume the admission fee is free, however, the visitors can buy other optional services, and the fees are listed below.

Insurance@5.5

Dolphin Show@20.0

Rent Bike@10.5

Butterfly Show@10.2

Rent Camera@8.0

Requirements:

Based on the selection, please calculate the subtotal.

If the thee or more than three items are selected, 10% off discount will be applied.

Display the subtotal, and total in a message box.

Explanation / Answer

1.
class Car {
String licensePlate;
double speed;   
double maxSpeed;
  
   Car()
   {
       licensePlate ="Go Fast";
       speed=60;
       maxSpeed=100;
   }
//car is moving at the speed of "speed"
void run() {
System.out.println("Car " + licensePlate + "is moving at " + speed + "miles per hour.");
}
}

2.
class cal
{
   public static void main(String args[])
   {
       double tot;
       int c;

       System.out.println("1. Insurance
2. Dolphin Show
3. Rent Bike
4. Butterfly Show
5. Rent Camera
6. Exit");
       Scanner scan = new Scanner(System.in);
       c=scan.nextInt();

       if(c==1)
           tot=tot+5.5;
      
       if(c==2)
           tot=tot+20.0;

       if(c==3)
           tot=tot+10.5;

       if(c==4)
           tot=tot+10.2;

       if(c==1)
           tot=tot+8.0;

      
       System.out.println("Total Amount ="+tot);
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote