Question

In: Computer Science

An auto company produced some models of cars that may be difficult to drive because the...

An auto company produced some models of cars that may be difficult to drive because the car wheels are not exactly round. Cars with model numbers 119, 179, 189 through 195, 221, and 780 have been found to have this defect. Create a CarRecall application that prompts a customer for the model number of their car to find out if it is defective and then displays “Your car is not defective.” when the user typed a model number without a defect. Otherwise, the message “Your car is defective. It must be repaired.” should be displayed. Application output should look similar to:

Enter the car's model number: 191

Your car is defective. It must be repaired.

Must be coded in Java.

Has to be easy code so no keyboard or any advanced coding.

Easiest code must be used for a grade 11 comp sci class I just started

Solutions

Expert Solution

Code:

import java.util.Scanner;/*importing the scanner class*/
class car
{
   public static void main(String[] args)
   {
       int carNum;/*Declared a variable carNum*/
       Scanner scnr=new Scanner(System.in);/*Creating scanner object*/
       System.out.print("Enter the car's model number:");
       carNum=scnr.nextInt();/*Reading the car model number*/
       if(carNum==119 || carNum==179 ||(carNum>=189 && carNum<=195)||carNum==221||carNum==780)
       {/*If car model numbers matches the above model numbers then we print it is defective*/
           System.out.print("Your car is defective. It must be repaired.");
       }
       else
       {
           /*Else we print it is not deffective*/
           System.out.print("Your cat is not defective");
       }
   }
}

Output:

Indentation;


Related Solutions

The Auto Trader lists thousands of cars for sale in a variety of marks and models....
The Auto Trader lists thousands of cars for sale in a variety of marks and models. A recent listing for Honda Civic LX Sedans shows the following price summary by year. t for Price Year. Regression (000) 2018 5 18.2 2017 4 17.5 2016 3 14.5 2015 2 10.7 2014 1 9.5 a) Sketch a scatter gram of Honda Civic Prices by year. b) Draw a line through this data that you think best fits the data. c) Calculate the...
Because accounting is considered the language of business, it may be difficult to think there is...
Because accounting is considered the language of business, it may be difficult to think there is a relationship between accounting and faith; however, the Christian worldview should and can permeate every discipline, even accounting. In what way(s) do you think the Christian worldview can integrate with accounting?
Comparative Advantage Models Suppose two products are being produced in the US, auto and wheat. Labor...
Comparative Advantage Models Suppose two products are being produced in the US, auto and wheat. Labor is the mobile factor used in both productions. Capital and Land are two specific factors. 1) Draw the butterfly graph four all four markets (product market, productions, and labor market) and clearly label all four axes. 2) Explain why the PPF is curved in the Specific Factors model. 3) Will the PPF curve be a straight line for HO model?
Sara’s Systems manufactures audio systems for cars. Two models are produced: The Standard model has a...
Sara’s Systems manufactures audio systems for cars. Two models are produced: The Standard model has a budgeted price of $225 and a standard variable cost of $105. The Blaster model has a budgeted price of $505 and a standard variable cost of $185. At the beginning of the year, Sara estimated that she would sell 6,100 Blaster models and 24,400 Standard models. The actual results for the year showed that 7,220 Blaster models were sold for total revenues of $2,888,000....
Velocity Racing School is a company that trains people to drive their sports cars on a...
Velocity Racing School is a company that trains people to drive their sports cars on a track. They are under contract with Thunderhill Raceway to train drivers on that track. They are paid $500 per student, and at the end of the month, they receive an additional $100 per student if 80% or more of the students rate the instructors as ‘excellent’. They are paid on the 10th of the following month. They make adjusting entries both mid and end...
An auto manufacturing company wanted to investigate how the price of one of its car models...
An auto manufacturing company wanted to investigate how the price of one of its car models depreciates with age. The research department at the company took a sample of eight cars of this model and collected the following information on the ages (in years) and prices (in hundreds of dollars) of these cars. Age 8 5 5 4 3 8 4 2 Price 32 48 60 60 65 25 64 71 Find the least squares regression line equation in the...
An auto manufacturing company wanted to investigate how the price of one of its car models...
An auto manufacturing company wanted to investigate how the price of one of its car models depreciates with age. The research department at the company took a sample of eight cars of this model and collected the following information on the ages (in years) and prices (in hundreds of dollars) of these cars. Age 8 3 6 9 2 5 6 3 Price 18 96 48 22 149 40 35 98 Compute the coefficient of determination. Round your answer to...
An auto manufacturing company wanted to investigate how the price of one of its car models...
An auto manufacturing company wanted to investigate how the price of one of its car models depreciates with age. The research department at the company took a sample of eight cars of this model and collected the following information on the ages (in years) and prices (in hundreds of dollars) of these cars. Age 3 3 3 7 3 3 7 7 Price 72 80 76 31 68 69 41 31 Find the least squares regression line equation in the...
An auto manufacturing company wanted to investigate how the price of one of its car models...
An auto manufacturing company wanted to investigate how the price of one of its car models depreciates with age. The research department at the company took a sample of eight cars of this model and collected the following information on the ages (in years) and prices (in hundreds of dollars) of these cars. Age 4 4 3 2 4 2 7 5 Price 70 62 78 75 54 72 42 44 Find the least squares regression line equation in the...
Some may argue that the findings of the Solomon Asch experiment are not terribly valuable because...
Some may argue that the findings of the Solomon Asch experiment are not terribly valuable because conformity is being assessed on a relatively innocuous task (i.e., choosing line sizes). What kind of situation might you use to test conformity that would be immune to this criticism? Can you think of a way to test conformity in the real world in a way that would be both useful and ethical?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT