Preparing a java program

Assignment Help Data Structure & Algorithms
Reference no: EM1380175

Prepare a program that asks the user how many automobiles are to be explained, and for each automobile it inputs the user's selection of make and color. Then it outputs color and make. Although you could do this easily using a simple procedural program, do it by using a main method in class AutomobileDriver to instantiate an object called auto from a class Automobile.

In the Automobile class, do the following:

Create a setMake() method. In this method, prompt the user "Input make of auto: ". Store their input into a make variable.
Create a setColor() method. In this method, prompt the user "Input color of auto: ". Store their input into a color variable.
Create "getter" methods for make and color.
Create a printAll() method. In this method, print the color and make of the automobile on one line in accordance to the sample session given below.

In the AutomobileDriver class, do the following:

Create an instance of Automobile.
Call the setMake() method.
Call the setColor() method.
Call the printAll() method.

Be sure your output is similar to the following:

How many autos do you want?: 2
Enter make: Honda
Enter color: Blue

Enter make: Chevy
Enter color: Red

You have a Blue Honda.
You have a Red Chevy.

 

Reference no: EM1380175

Questions Cloud

C program that accepts a month and day : Make a C program that accepts a month and day for example, June 14 from the keyboard as input. Store this data in a string called date.
Finding the values of queuefront and queuerear : Assume that queue is a queue type object and the size of the array-implementing queue is 100. Also, assume that the value of the queueFront is 25 and the value of queueRear is twenty-five.
Creating an automated checkout program : A local department store employee you to create an automated checkout program to expedite customers in a hurry. The checkout line can only allow 5-products for any one purchase.
Java program to make choice for a coffee cup size : Create an application that prompts the user to make a choice for a Coffee cup size, S for Small, T for Tall, G for Grande and V for Venti the rates of cup sizes will be stored in a parallel double array as $2, $2.50, $3.25, and $4.50 respectively.
Preparing a java program : Prepare a program that asks the user how many automobiles are to be explained, and for each automobile it inputs the user's selection of make and color.
Creating villian : Announce a new Villian called sharpay who has a wit of 24, a stealth of sixteen, and who has currently claimed three victims: Chad, Troy, and Gabriella.
Creating a class for services : Make a class for services offered by a hair styling salon. Information fields with a String to hold the service description, a double to hold the price, and an integer to hold average number of minutes it takes to perform the service.
Design and implement a sorting algorithm : Your task is to design and implement a sorting algorithm and running time grows as a linear function of the array
Important java questions : Add a method addText to the Question class, and provide a different implementation of Choice Question that calls add Text rather than storing an array list of selections.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Describe a fair coin algorithm to returns either 0 or 1

Describe a FAIRCOIN algorithm that returns either 0 or 1 with equal probability, using ONEINTHREE as your only source of randomness.

  Explain compression algorithms are often used in forensics

"Compression algorithms are often used in forensics. Suppose you are involved in a case and have been asked by the lawyer to explain, in general terms.

  How many leaf nodes can a decision tree have

At most how many leaf nodes can a decision tree have if it is consistent with a training set containing 100 examples?

  Creating class diagram

Think about a computer system used to manage loans for a library. Libraries loan books, CDs, videos and magazines to registered members.

  Explaining playout delay algorithm

Let the adaptive playout delay algorithm. Show through simple example that adjusting playout delay at beginning of each talk.

  Give algorithm to find schedule to obtain maximum profit

Give an algorithm to find the schedule that obtains the maximum amount of profit, assuming that all processing times are integers between 1 and n.

  Creating an object oriented data model

Create an object oriented data model, including all appropriate notations, to represent the given situation. In a particular region there are a number of gardens.

  Transmitting image using raster scan order

If we were to transmit this image using raster scan order, after 15 seconds how many rows of the image will the user have received?

  Sql statements

Suppose that the tables T1 and T2 have a 1:1 relationship. Suppose that T2 has the foreign key. Demonstrate the SQL statements necessary to move the foreign key to T1.

  Create world database using mysql

create World database using MySQL and write a Java or C# or program to access the DB

  Factors-principles considering indecency regulation issues

What factors and principles should the federal government take into account when considering indecency regulation issues?

  Analyze algorithm to determine length of longest substring

Explain and analyze the algorithm to determine the length of longest substring that appears both forward and backward in an input string T[1 . n].

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd