1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Musya8 [376]
3 years ago
12

Given main(), complete the Car class (in file Car.java) with methods to set and get the purchase price of a car (setPurchasePric

e(), getPurchasePrice()), and to output the car's information (printInfo()).
Ex: If the input is:
2011
18000
2018
where 2011 is the car's model year, 18000 is the purchase price, and 2018 is the current year, the output is:
Car's information:
Model year: 2011
Purchase price: 18000
Current value: 5770
Note: printInfo() should use three spaces for indentation.
Computers and Technology
1 answer:
mylen [45]3 years ago
4 0

Answer and Explanation:

public class Main {

int Carmodel;

int Purchaseprice;

int Currentyear;

Public void setPurchasePrice(int Purchaseprice){

this.Purchaseprice=Purchaseprice;

}

Public void getPurchasePrice(){

return Purchaseprice;

}

static void printInfo(int Carmodel int Currentyear ){

this.Carmodel=Carmodel;

this.Currentyear=Currentyear;

System.out.println(getPurchasePrice() Carmodel Currentyear);

}

}

The above java program defines a class that has three methods, a get method that returns purchase price of the object, a set method that sets purchase price of the object, and a print method that print out the information about the car object(model, year, price). The print method also takes arguments and assigns values of the arguments/parameters to the object, then prints all.

You might be interested in
The element of website design that refers to the website's aesthetic appeal and the functional look and feel of the site's layou
zzz [600]

The element of website design that refers to the website's aesthetic appeal and the functional look and feel of the site's layout and visual design is known as context.

<h3>What is webpage context?</h3>

The web page context is known to be a kind of special ID that is is formed with all the new page load event.

The context of a website is known to be the point or place where a person can show their visitors that one care. It gives a kind of website's aesthetic appeal and the functional look.

Learn more about website design from

brainly.com/question/25941596

6 0
2 years ago
Implement a function named largerThanN that accepts three arguments: an array of type int, the size of the array of type int and
levacccp [35]

Answer:

import java.util.Scanner;

public class NewArray {

//Main Method begins here

   public static void main(String[] args) {

   int [] numbers = {30,20,50,2,-1,44,3,12,90,32}; //The given array

   Scanner in = new Scanner(System.in);

       System.out.println("enter a number");

       int n = in.nextInt(); //Receive the number from the user

       //Calling the method largerThanN

       largerThanN(numbers, numbers.length,n);

   }

//The method largerThanN begins here

   public static void largerThanN(int []intArray, int arraySize, int n){

       for(int i = 0; i < intArray.length; i++){

           if(intArray[i] > n){

               System.out.println(intArray[i]);

           }

       }

   }

}

Explanation:

Uisng the Java prograamming language the solution is provided above.

Please see the comments within the code for detailed explanation

The key logic within the method largerThanN () is using a for loop to iterate the entire array. Within the for loop use an if statement to compare each element with the the number n entered by the user

6 0
3 years ago
The interactive process through which people learn the basic skills, values, beliefs, and behavior patterns of a society.
irina1246 [14]
The answer is : Socialization

the interactive process through which people learn the basic skills, values, beliefs, and behavior patterns of a society is called Socialization
During socialization process, a person tend to understand what is acceptable in the society and which is not. During the process, a person could also discover various unique characteristics from each individual
6 0
3 years ago
¿Cuáles son las ventajas de manejar la nube?
igomit [66]

Answer:

What are the advantages of managing the cloud=(Englishish)What are the advantages of managing the cloud?

Lower IT Costs. Businesses requiring IT services save money using third-party providers vs bringing talent in-house. ...

Computing Resources. Heavy computation cycles need extensive hardware resources. ...

Accessibility. ...

Always Updated. ...

Scaling. ...

Backup/Recovery. ...

Integration. ...

Security.

In spanish.....  (Costos de TI más bajos. Las empresas que requieren servicios de TI ahorran dinero utilizando proveedores externos en lugar de traer talento internamente. ...

Recursos informáticos. Los ciclos de computación intensos necesitan amplios recursos de hardware. ...

Accesibilidad. ...

Siempre actualizado. ...

Escalada. ...

Recuperación de respaldo. ...

Integración. ...

Seguridad.)

Explanation:

8 0
3 years ago
g Write a recursive function all capital (L,start ,stop) that takes a string L and two integers. It returns a Boolean (True/Fals
Anton [14]

Answer:

def recursive(L, start, stop):

         y = L[start:stop]

         print(y.isupper())

recursive("ALLow", 0, 3)

Explanation:

The code is written in python.

def recursive(L, start, stop):

The function is defined known as recursive. The function takes a string and 2 integers known as start and stop. The parameter L is a string and the other 2 parameter start and stop are integers which indicates the index range of the string L.  

y = L[start:stop]

A variable y is declared to store the string L with the index range from start to stop . Note start and stop are integers.

print(y.isupper())

The code prints True if the index range of the string L are all upper case else it print False.

recursive("ALLow", 0, 3)

This code calls the function with the required parameters L(string), Start(integer) and stop(integer)

 

8 0
3 years ago
Other questions:
  • ___ is the branch of computer science that explores techniques for incorporating aspects of intelligence into computer systems.
    5·1 answer
  • What is cloud storage?​
    11·1 answer
  • There is no need to schedule video calls ahead of time; they can be used the same way as
    6·1 answer
  • A _____ is a device that not only provides surge protection, but also furnishes desktop computers and network devices with batte
    7·1 answer
  • Two electronics technicians are measuring electrical quantities in circuits. Technician A says that copper, glass, porcelain, an
    13·2 answers
  • The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future
    13·1 answer
  • In 1-2 sentences, describe how to use the thesaurus in the Word Processor you have used.
    7·2 answers
  • I don't know if this is supposed to go here or art but i need help with photoshop, basically you can create whatever you want bu
    7·1 answer
  • What is the difference between a programming language and natural (every-day) language?
    12·1 answer
  • What is an example of a device that commonly use Linux today
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!