Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA CODING: public class Main { public static void main(String[] args) { final int roadServiceMonth = 6; MiniCooperS mini = new MiniCooperS(roadServiceMonth); mini.steer(45); mini.steer(10); mini.steer(-5);

JAVA CODING:

image text in transcribed

image text in transcribed

public class Main {

public static void main(String[] args) {

final int roadServiceMonth = 6;

MiniCooperS mini = new MiniCooperS(roadServiceMonth);

mini.steer(45);

mini.steer(10);

mini.steer(-5);

mini.accelerate(30);

mini.accelerate(20);

mini.steer(20);

mini.accelerate(-45);

mini.accelerate(5);

mini.steer(0);

mini.accelerate(-10);

System.out.println(mini.toString());

}

}

image text in transcribed

Q1: (50 marks): Building a Car with automatic gear shifting You are building a car that will shift gear (automatically) base on the velocity changed according the following table high 10 20 30 40 > 41 Gears 1 2 low 0 21 31 41 4 5 For this problem, there are three main components (vehicle, Car, and your specific car) You can start with a base class Vehicle, and then create a Car class that inherits from this base class (Vehicle). From the Car class you can create a specific car (that you like) and inherits from the Car class. I like my MiniCooperS convertible and I use that for my example. From my mini, I want to be able steer (turn in 0 to 80 degrees) to change directions, and change velocity

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions