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
marissa [1.9K]
3 years ago
11

What is output when the CarTest application is run? Why?

Computers and Technology
1 answer:
erik [133]3 years ago
5 0

Answer:

red

Explanation:

public class CarTest {

public static void main(String[] argvs) {

//below line will create an object of CarTest class Object

CarTest carTest = new CarTest();

//This will call runDemo method

carTest.runDemo();

}

public void runDemo() {

//Below line will create an object of Car class  with color blue and 4 wheel

Car c = new Car("blue", 4);

//Bellow Line will change the color from blue to red, see the logic writteen in chnageColor method definition

changeColor(c, "red");

//Below line will print the color as red

System.out.println(c.getColor());

}

public void changeColor(Car car, String newColor) {

//This line will set the color as passed color in the car object

car.setColor(newColor);

}

}

You might be interested in
Assume the variable myWord references a string. Write a statement that uses a slicing
givi [52]

Answer:

"myWord[-5:]"

Explanation:

So whenever you slice a string, the syntax in python is expressed as:

string[a:b:c]

where a=start index (this is included in the sliced string)

b = end index (this is excluded from the sliced string)

c = increment

If any of these are included, they are set to default values, where a=0, b=len(string), and c=1.

The increment isn't necessary here, and it's just so you know the syntax a bit more

Anyways, I'm assuming when the question asks to display "the last 5 characters in the string" it means in order? e.g "abcdefghijk" -> "ghijk" and not "abcdefghijk" -> "kjihg"

The last piece of information to know is what a negative index represents.

For example if I have the piece of code

"

string = "hello world"

print(string[-1])

"

This will output "d", and the negative 1 represents the last letter. If you did -2, it would output the 2nd to last letter and so on.

So to print the last 5 characters, we simply use the -5 as the starting index.  

"

string = "hello world"

print(string[-5:])

"

This will print "world" or in other words, the last 5 letters. The reason for this is because the -5 in the first spot means the starting index is the 5th to last letter, and when you have the : after the -5, this is the way of telling python you're slicing the string, and not indexing 1 character. You don't need to include another value after that, because it will default to the last index of the string, or more specifically the last index + 1, since the last index is still included.

So the last thing to know, is that if the string isn't greater than 5 characters, it just prints the entire string, and no errors are raised. You can test this out your self as well. So whenever you have a string that's less than 5 characters the entire string is outputted.

3 0
1 year ago
The purpose of a good web page design is to make it
meriva

Answer:

Hi , so your answer is that a good web page design is to make it easy to use and meaningful and able to help people .

Explanation:

Really hope i helped , have a nice day :)

5 0
3 years ago
Read 2 more answers
Amtex Electronics, a consumer products brand, frequently advertises its products inside supermarkets and retail stores to promot
Aloiza [94]

Answer:

Amtex Electronics promotes the process of memory retrieval and stimulate purchase.

Explanation:

Recall or retrieval of memory refers to information from the past, which has encoded and stored in the brain. It is known as remembering.

For example, the memory of your son drinking juice is an example of retrieval. Memory had been stored in long- term memory.

Many types of memory retrieval are recall and recognition. This information must be retrieved from memories.

3 0
3 years ago
Wht is RAM called Random Access memory and ROM IS called Read only memory​
nasty-shy [4]

Answer: Computer memory is of two basic type – Primary memory(RAM and ROM) and Secondary memory(hard drive,CD,etc.). Random Access Memory (RAM) is primary-volatile memory and Read Only Memory (ROM) is primary-non-volatile memory.

Explanation: Hope this helps :)

6 0
3 years ago
Which of the following arguments are valid? Explain your reasoning
klio [65]

Answer:

a) the Statement is Invalid

b) the Statement is Invalid

Explanation:

a)

lets Consider, s: student of my class

A(x): Getting an A

Let b: john

I have a student in my class who is getting ab A: Зs, A(s)

John need not be the student i.e b ≠ s could be true

Hence ¬A(b) could be true and the given statement is invalid

b)

Lets Consider G: girl scout

C: selling 50 boxes of cookies

P: getting prize

s: Suzy

Now every girl scout who sells at least 50 boxes of cookies will get a prize: ∀x ∈ G, C(x) -> P(x)

Suzy, a girl scout, got a prize: s ∈ G, P(s)

since P(s) is true, C(s) need not be true

Main Reason: false → true is also true

Therefore the Statement is Invalid

7 0
3 years ago
Other questions:
  • A typical serial cable has
    13·1 answer
  • How does an employer judge a candidate?<br> The employer judge's the candidate's ? for a job.
    12·1 answer
  • What are the first and the last physical memory addressesaccessible using
    10·1 answer
  • The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
    5·1 answer
  • If you see ________________________ in a cell, it means the column is not wide enough to display the cell content. Select one: a
    15·1 answer
  • Why are medical related professions and human resources important? ​
    8·1 answer
  • What is first page of website called​
    10·1 answer
  • Computer science practical on VB.NET. program 1. program to find the square of a number. write the code achieve it​
    6·1 answer
  • IN EXCEL, File, menu , edit, insert are all located in ?
    7·1 answer
  • A(n) ____ is a web-based repository of information that anyone can access, contribute to, or modify.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!