public class Car {
public void m1() {
System.out.println("car 1");
}
â
public void m2() {
System.out.println("car 2");
}
â
public String toString() {
return "vroom";
}
}


public class Truck extends Car {
public void m1() {
System.out.println("truck 1");
}
}

And assuming that the following variables have been declared:

Car mycar = new Car();
Truck mytruck = new Truck();

What is the output from the following statements?

a. Sound F/X System.out.println(mycar);
b. mycar.m1();
c. mycar.m2();
d. System.out.println(mytruck);
e. mytruck.m1();
f. mytruck.m2();

Answers

Answer 1

Answer:

The Following are the outputs:

a. vroom

b. car 1

c. car 2

d. vroom

e. truck 1

f. car 2

Explanation:

The first statement System.out.println(mycar);  prints an instance of the Car object my car which calls the toString() method.

The second statement mycar.m1();  Calls the method m1() which prints car1

The third statement mycar.m2(); calls the method m2() which prints car2

Then another class is created Truck, and Truck inherits all the methods of Car since it extends Car. Truck has a method m1() which will override the inherited method m1() from the Car class.

The fourth statement System.out.println(mytruck); will print print vroom just as the first statement since it inherits that method toString()

The fifth statement calls m1() in the Truck class hence prints Truck 1

Finally the sixth statement will print car 2 because it also inherited that method and didnt overide it.


Related Questions

hi hi hihihihihivvv hihihihihihi v vhi

Answers

Answer: hihihihihihiihihi hihihihiihihih

Explanation: hi.

As you know computer system stores all types of data as stream of binary digits (0 and 1). This also includes the numbers having fractional values, where placement of radix point is also incorporated along with the binary representation of the value. There are different approaches available in the literature to store the numbers having fractional part. One such method, called Floating-point notation is discussed in your week 03 lessons. The floating point representation need to incorporate three things:
• Sign
• Mantissa
• Exponent

A. Encode the (negative) decimal fraction -9/2 to binary using the 8-bit floating-
point notation.
B. Determine the smallest (lowest) negative value which can be
incorporated/represented using the 8-bit floating point notation.
C. Determine the largest (highest) positive value which can be
incorporated/represented using the 8- bit floating point notation.

Answers

Answer:

A. Encode the (negative) decimal fraction -9/2 to binary using the 8-bit floating-point notation.

First, let's convert -9/2 to a decimal number: -9/2 = -4.5

Now, let's encode -4.5 using the 8-bit floating-point notation. We'll use the following format for 8-bit floating-point representation:

1 bit for the sign (S), 3 bits for the exponent (E), and 4 bits for the mantissa (M): SEEE MMMM

Sign bit: Since the number is negative, the sign bit is 1: 1

Mantissa and exponent: Convert -4.5 into binary and normalize it:

-4.5 in binary is -100.1. Normalize it to get the mantissa and exponent: -1.001 * 2^2

Mantissa (M): 001 (ignoring the leading 1 and taking the next 4 bits)

Exponent (E): To store the exponent (2) in 3 bits with a bias of 3, add the bias to the exponent: 2 + 3 = 5. Now, convert 5 to binary: 101

Now, put the sign, exponent, and mantissa together: 1101 0010

So, the 8-bit floating-point representation of -9/2 (-4.5) is 1101 0010.

B. Determine the smallest (lowest) negative value which can be incorporated/represented using the 8-bit floating-point notation.

To get the smallest negative value, we'll set the sign bit to 1 (negative), use the smallest possible exponent (excluding subnormal numbers), and the smallest mantissa:

Sign bit: 1

Exponent: Smallest exponent is 001 (biased by 3, so the actual exponent is -2)

Mantissa: Smallest mantissa is 0000

The 8-bit representation is 1001 0000. Converting this to decimal:

-1 * 2^{-2} * 1.0000 which is -0.25.

The smallest (lowest) negative value that can be represented using the 8-bit floating-point notation is -0.25.

C. Determine the largest (highest) positive value which can be incorporated/represented using the 8-bit floating-point notation.

To get the largest positive value, we'll set the sign bit to 0 (positive), use the largest possible exponent (excluding infinity), and the largest mantissa:

Sign bit: 0

Exponent: Largest exponent is 110 (biased by 3, so the actual exponent is 3)

Mantissa: Largest mantissa is 1111

The 8-bit representation is 0110 1111. Converting this to decimal:

1 * 2^3 * 1.1111 which is approximately 1 * 8 * 1.9375 = 15.5.

The largest (highest) positive value that can be represented using the 8-bit floating-point notation is 15.5.

Explanation:

A stack is a ___________________ data structure.

Answers

Answer:

A stack is a base data structure.

if we add 100 + 111 using a full adder, what is your output?

Answers

A digital circuit that performs addition is called a full adder. Hardware implements full adders using logic gates. Three one-bit binary values, two operands, and a carry bit are added using a complete adder. Two numbers are output by the adder: a sum and a carry bit. 100 has the binary value, 1100100.  Is your output.

What full adder calculate output?

When you add 1 and 1, something similar occurs; the outcome is always 2, but because 2 is expressed as 10 in binary, we receive a digit 0 and a carry of 1 as a result of adding 1 + 1 in binary.

Therefore, 100 has the binary value, 1100100. As we all know, we must divide any number from the decimal system by two and record the residual in order to convert it to binary.

Learn more about full adder here:

https://brainly.com/question/15865393

#SPJ1

1) prepare and algorithm that indicates the logic for printing the name and phone number for each female in a file ( code field is 2 for female ..
DRAW A FLOW CHART ...

Answers

An algorithm that indicates the logic for printing the name and phone number is given below:

What is algorithm?

An algorithm is a step-by-step set of instructions which, given certain inputs, will produce a desired output. Algorithms are used in computer programming to solve a variety of tasks, from basic calculations to complex problems. They can be used for sorting, searching, and data manipulation. Algorithms are also employed in artificial intelligence (AI) to create autonomous systems. An algorithm can be designed to operate on a single machine or on a network of machines. Algorithms are designed to be efficient, meaning they can be completed quickly and with minimal resources.

Start

Read file line by line

IF code field is equal to 2

  Print name and phone number

End

To learn more about algorithm

https://brainly.com/question/29927475

#SPJ1

An engineer is writing above the HTML page that currently displays a title message in large text at the top of the page . The engineer wants to add a subtitle directly underneath that is smaller than the title but still longer than most of the text on page

Answers

<!DOCTYPE html>

<html>

<body>

<h1>Heading or Title</h1>

<h2>Sub heading or sub title</h2>

</body>

</html>

This will be the html code for the given problem.

Which four of the following are true about fair use?

Which four of the following are true about fair use?

Answers

D,C,B

Should be the correct answers. I'm not the best when it comes to copyright but I believe those are correct.

Your company has been assigned the 192.20.0.0/24 network for use at one of its sites. You need to use a subnet mask that will accommodate 30 subnets while simultaneously accommodating the maximum number of hosts per subnet. What subnet mask will you use in CIDR notation?

Answers

To accommodate 30 subnets while maximizing the number of hosts per subnet, the appropriate subnet mask in CIDR notation would be /27.

What would this do?

This provides 5 bits for subnetting, allowing for 32 (2^5) subnets. Each subnet can then have up to 30 (2^5 - 2) usable host addresses.

The subnet mask /27 effectively divides the original 192.20.0.0/24 network into 30 subnets with the maximum number of hosts per subnet.

Therefore, to accommodate 30 subnets while maximizing the number of hosts per subnet, the appropriate subnet mask in CIDR notation would be /27.

Read more about subnet mask here:

https://brainly.com/question/28390252

#SPJ1

What certificates does the Common Access Card CAC or personal identity verification?

Answers

Answer: CAC is based on X. 509 certificates with a software middleware that lets a operating system interface your card

Explanation:

HELP ASAPPPP PLSSSSS!!!!!! The purpose of capillary tubes is to:


permit oxygen and nutrients to be absorbed by cells
allow blood to complete a path between arteries and veins
reverse the flow of blood
provide a means for cell wastes to enter the blood stream

Answers

Answer:

Permit oxygen and nutrients to be absorbed by cells

Explanation:

Because ,the capillaries arw the smallest of the blood vessels they act as a bridge between the two main..vessels

what are bananas if they are brown

Answers

they are ripe or overripe (rotten)

if banans are Brown there bad I think

Integers japaneseGrade, readingGrade, spanishGrade, and numGrades are read from input. Declare a floating-point variable avgGrade. Compute the average grade using floating-point division and assign the result to avgGrade.

Ex: If the input is 74 51 100 3, then the output is:


75.00
how do i code this in c++?

Answers

Answer:

#include <iostream>

int main()

{

   int japaneseGrade, readingGrade, spanishGrade, numGrades;

   

   std::cin >> japaneseGrade >> readingGrade >> spanishGrade >> numGrades;

   

   float avgGrade = (float)(japaneseGrade + readingGrade + spanishGrade) / numGrades;

   

   std::cout << avgGrade;

 

   return 0;

}

Final answer:

To solve this problem in C++, you can use the cin function to read the integer inputs, declare a float variable for the average grade, and then compute the average grade using floating-point division. Finally, use the cout function to output the average grade with two decimal places.

Explanation:

To solve this problem in C++, you can use the cin function to read the integer inputs, and then use the float data type to declare the avgGrade variable. After reading the input integers, you can compute the average grade by dividing the sum of the grades by the total number of grades. Finally, you can use the cout function to output the average grade with two decimal places

#include

using namespace std;

int main() {

 int japaneseGrade, readingGrade, spanishGrade, numGrades;

 float avgGrade;

 cout << "Enter the Japanese grade: ";

 cin >> japaneseGrade;

 cout << "Enter the Reading grade: ";

 cin >> readingGrade;

 cout << "Enter the Spanish grade: ";

 cin >> spanishGrade;

 cout << "Enter the number of grades: ";

 cin >> numGrades;

 avgGrade = (japaneseGrade + readingGrade + spanishGrade) / static_cast(numGrades);

 cout << "The average grade is: " << fixed << setprecision(2) << avgGrade << endl;

 return 0;

}
Learn more about Computers and Technology here:

https://brainly.com/question/34031255

#SPJ2

All changes
1.(01.01 LC)
To make sure you do not get too tired when using the computer for long periods of time, how often should you get up to stretch and move? (5 points)
O Every hour
O Every 10 minutes
O Every 30 minutes
O Every two hours

Answers

You should get up and move every 30 minutes

Hope  this helps

-scav

Answer:

C

Explanation:

A technician is installing new power supplies for the application engineering team's workstations. The management team has not yet made a decision about installing dual graphics cards, but they want to proceed with the project anyway. Which of the following power supplies would provide the BEST solution?

Answers

Answer:

a

Explanation:

The 500W redundant power supply. is the most ideal decision, offering adequate power and reinforcement in the event of a power supply disappointment. Hence, option C is the right answer.

Which of the following power supplies would provide the best solution?

The BEST answer for the professional to install new power supplies for the application engineering team's workstations would be choice C: 500W redundant power supply.

A 1000W 24-pin measured power supply might be unreasonable for the workstations, possibly prompting failures and higher power utilization.

A 220VAC 9000J flood defender isn't a power supply; it just safeguards against voltage spikes.

A 2000VA uninterruptible power supply (UPS) may give reinforcement power in the event of blackouts, however, it isn't guaranteed to address the requirement for dual graphics cards.

The 500W repetitive power supply offers adequate power limits with respect to the workstations and overt repetitiveness, guaranteeing persistent activity regardless of whether one power supply falls flat. This considers potential double illustration cards from here on out, settling on it as the most reasonable decision for the task.

Learn more about power supply here:

https://brainly.com/question/29979352

#SPJ2

QUESTION 7
Any use of a direct quote or paraphrased idea does not need to be cited properly in APA style.
O True
O False

Answers

false, it needs to be properly cited because that is plagiarism which is illegal

Which factor increases the risk of IS project delays?
A.
loss of hardware
B.
shortage of technical staff
C.
poor password practices
D.
loss of equipment
E.
environmental issue

Answers

im going to say A
Explanation:
It talks about how it is a delay and if you lose
something its going to delay whatever you are

Where or what website can I download anime's? For free ​

Answers

https://todo-anime.com/

The ___ bar changes depending on which tool is currently selected…?

Answers

Answer: Options (I'm not 100% sure but I think its options.) Have a nice day!

Answer:

Options (I'm not 100% sure but I think it's options.) Have a nice day!

Explanation:

Barbarlee suspected and found a loophole in the university computer's security system that allowed her to access other students' records. She told the system administrator about the loophole, but continued to access others' records until the problem was corrected 2 weeks later. Was her actions unethical or not. Explain your position? What should be the suggested system administrators response to Barbarlee's actions? How should the university respond to this scenario?​

Answers

Answer:

Explanation:

I can give you my opinion on the matter, not sure if this was taught to you or not so please take it with a grain of salt.

Her actions are highly unethical and even illegal to some extent. Especially in USA, FERPA prevents random people from accessing your educational records without your permission and there's hundreds of universities with their own rules/regulations on protecting students' privacy. The sys admin should have first recorded this event when she reported it and then actually went into the system to see if unwanted access has been done by any user(s). University should look at disciplinary actions since the person willingly accessed the system even after they reported the bug and also let ALL the university student/faculty/staff know of the problem and how they plan on fixing it.

This is only a summary, and this is my opinion. please expand in places where needed.

I found another answer in go.ogle:

I feel the actions of this person were unethical.

The student's action in searching for the loophole was neither definitively ethical nor unethical, as their motives are unclear.

The student's action in continuing to access records for two weeks was unethical, as this is a violation of privacy.

The system admin's failure to correct the problem could be considered unethical, but it is difficult to surmise, as there are not enough details.

how do i get a instant win in 1v1 lol online

Answers

Answer:

you can practice a lot all the day to become a pro, and see videos of how to win ( in the game of the 1v1) and do it and well that

Explanation:

hope it helps

How many assignments would you have failed without brainly?

lol.

Answers

How many assignments would I have failed without brainy? Lol

ALL OF THEM

You and your roommate decide to reduce your environmental impact by recycling more, going paperless, and using environmentally safe cleaning products. You know you also can use green computing tactics to reduce electronic waste, minimize power use, and more. Create a list of five reasons why you should add green computing to your efforts. List 10 ways you can apply green computing to your daily life.

Answers

Answer:

first one is (a) next one is (b)

Explanation:

By integrating the following green computing practices into your daily life, you and your roommate can make a meaningful contribution to environmental conservation and sustainability.

Five Reasons to Add Green Computing to Your Efforts:

Reduce Electronic Waste: Green computing involves extending the lifespan of electronic devices through efficient usage and proper disposal. By adopting green computing practices, you can contribute to the reduction of electronic waste, which is a significant environmental concern.

Minimize Energy Consumption: Green computing focuses on using electronic devices more efficiently to reduce energy consumption. This not only saves you money on energy bills but also helps lower overall energy demand, leading to a decrease in greenhouse gas emissions.

Extend Device Lifespan: By practicing responsible usage, such as shutting down or putting devices in low-power modes when not in use, you can extend the lifespan of your electronics. This reduces the need for frequent replacements, saving resources and energy.

Promote Sustainable Manufacturing: The demand for new electronic devices contributes to resource extraction and energy-intensive manufacturing processes. Green computing practices encourage people to make more conscious purchasing decisions, supporting sustainable manufacturing practices.

Contribute to a Greener Future: Embracing green computing aligns with broader environmental goals and initiatives. By incorporating these practices into your daily life, you become part of a collective effort to create a more sustainable and eco-friendly future.

Ways to Apply Green Computing to Your Daily Life:

Power Management: Enable power-saving features on your devices, such as sleep mode and automatic screen dimming, to reduce energy consumption when idle.

Unplug Chargers: Unplug chargers and power cords when not in use, as they continue to draw energy even when devices are not connected.

Energy-Efficient Devices: When purchasing new devices, opt for those with Energy Star certifications or energy-efficient ratings to reduce overall energy consumption.

Digital Documentation: Transition to digital documentation and e-receipts to reduce paper usage and the need for physical storage.

Cloud Storage: Utilize cloud storage for data and files, which reduces the need for physical storage devices and their associated energy consumption.

Eco-Friendly Cleaning: Use eco-friendly cleaning products to clean your devices and workspaces, avoiding harmful chemicals that can impact both your health and the environment.

Virtual Meetings: Opt for virtual meetings and communication tools to reduce the need for travel and associated carbon emissions.

Server Consolidation: If you run servers for personal use or small projects, consider consolidating them to use fewer resources and minimize power consumption.

Learn more about environmental conservation click;

https://brainly.com/question/27439044

#SPJ3

Daiki is creating a database for a paint store. Each color of paint would have its own record which will include the color name price and size. The price of the paint will be in its own a) table b) file c) field d) format

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is c)field.

As we know that the feature of an entity is represented by its attribute in the database table. A database table is a set of records of different fields. Each field represents a row in a database table. Each field can contain a set of attributes related to an entity such as a paint color.

So the price of paint will be in its own field. Because there are different colors in the database table. Each color has its own record in form of a field. As you know that each field is a row in the database table. So, each row has the price of a paint color.

Other options are not correct because:

The table contains a list of fields and each field contains its own paint price. The format and file is something different and does not have any relation with the question scenario.

Answer:

C) Field

Explanation:

I took the test

You work part-time at a computer repair store. You are building a new computer. A customer has purchased two serial ATA (SATA) hard drives for his computer. In addition, he would like you to add an extra eSATA port that he can use for external drives. In

Answers

Install an eSATA expansion card in the computer to add an extra eSATA port for the customer's external drives.

To fulfill the customer's request of adding an extra eSATA port for external drives, you can install an eSATA expansion card in the computer. This expansion card will provide the necessary connectivity for the customer to connect eSATA devices, such as external hard drives, to the computer.

First, ensure that the computer has an available PCIe slot where the expansion card can be inserted. Open the computer case and locate an empty PCIe slot, typically identified by its size and the number of pins. Carefully align the expansion card with the slot and firmly insert it, ensuring that it is properly seated.

Next, connect the power supply cable of the expansion card, if required. Some expansion cards may require additional power to operate properly, and this is typically provided through a dedicated power connector on the card itself.

Once the card is securely installed, connect the eSATA port cable to the expansion card. The cable should be included with the expansion card or can be purchased separately if needed.

Connect one end of the cable to the eSATA port on the expansion card and the other end to the desired location on the computer case where the customer can easily access it.

After all connections are made, close the computer case, ensuring that it is properly secured. Power on the computer and install any necessary drivers or software for the expansion card, following the instructions provided by the manufacturer.

With the eSATA expansion card installed and configured, the customer will now have an additional eSATA port available on their computer, allowing them to connect external drives and enjoy fast data transfer speeds.

For more question on computer visit:

https://brainly.com/question/30995425

#SPJ8

Select the correct answer.
Vivian used an effect in her audio editing software that made the loud parts in her audio softer while ignoring the quieter parts. Which effect did Vivian use?
A.
noise reduction
B.
normalize
C.
amplify
D.
compress

Answers

Answer:

A. noise reduction

Explanation:

noise reduction reduces the loud sounds and makes it low, also noted that the low sounds are kept the same meaning its definitely noise reduction.

Extra's:

amplify - increases the strength of a sound.compress - makes and affects both low and high sound by making them averagely highnormalise - to get the maximum volume.

Determine the median paycheck from the following set:

{$100, $250, $300, $400, $600, $650}

$300

$350

$450

$600

Answers

Answer:

My answer to the question is $350.

The middle numbers are $300&$400.

300+400=700/2=350.

Answer:

$350

Explanation:

every object on the web has a unique address called its question 4 options: uniform resource locator hashtag. ip address. server

Answers

Every object on the web has a unique address called its Uniform Resource Locator (URL).

What is URL?

URL stands for Uniform Resource Locator. It is a web address used to access a particular website or web page. URLs are composed of a protocol, domain name, and path. The protocol specifies the type of access to use, the domain name specifies the domain of the website, and the path specifies the specific web page within the domain. URLs can contain query strings which provide additional parameters to the web page. URLs are used to access web pages on the internet, allowing users to browse websites, find information, and interact with web applications.

To know more about URL
https://brainly.com/question/14716338
#SPJ4

Which of the following could be considered an algorithm?


directions for assembling a bicycle


the pages in a book


a file system directory


an application
F

Answers

The best answer is an application

please help me social media marketing

please help me social media marketing

Answers

It’s B, just took test like this it’s was correct

In order to average together values that match two different conditions in different ranges, an excel user should use the ____ function.

Answers

Answer: Excel Average functions

Explanation: it gets the work done.

Answer:

excel average

Explanation:

Other Questions
Which factors affect the performance of a solar cell? i need the answer and work plss help Record the following transactions as general journal entries. Use the gross-price method. Aug. 6 Purchased $830 of merchandise on account from Johnston Co. Credit terms 2/10, n/30. 8 Bought an $18,000 truck from Pillner Co., paying $3,000 down; balance on account. 13 Purchased $2,611 of merchandise for cash from Pillner and Co. 15 Paid for the August 6 purchase of merchandise from Johnston Co. 17 Purchased $1,743 of merchandise from Luis Co. Credit terms 2/10, n/30. The average age of 25 girls 10 years if one girl aged 12 years and 4 months join the group correct to one decimal place the new average age of the groups using matlab to answerc. Create a 5 x 5 random matrix A 1. Obtain B as the inverse matrix of A II Obtain C as AB III. Comment on (4 marks) is one liter about an ounce, a pint, a quart, or a gallon? true or false Write a summary of The Human Brain.Write a summary of The Human Brain.A summary is a concise, complete, and accurate overview of a text. It should not include a statement of your opinion or an analysis. Utilize your new vocabulary words and make sure to include evidence and key details from the text. I also don't understand what the 's' is in this problem.Solve the systemm { x1 -x2 +4x3 = -46x1 -5x2 +7x3 = -53x1 -39x3 = 45 }[x1] = [ __ ] [ __] [x2] = [ __ ] +s [ __] [x3] = [ __ ] [ __] Often when we are watching movies or television, we do not notice all of the sounds that the sound engineer has added. Why not?Sounds are only added when a scene is not working well.Sounds are not designed to be noticed or heard during films.Most media do not need any additional sounds to be engaging.When well done, they do not stand out and add to the experience. ! HELP I WILL GIVE BRAINLEST ! ! HELP I WILL GIVE BRAINLEST ! ! HELP I WILL GIVE BRAINLEST ! ! HELP I WILL GIVE BRAINLEST ! ! HELP I WILL GIVE BRAINLEST ! ! HELP I WILL GIVE BRAINLEST ! si (a+b+c)2 =361 calcular: a5bc + b2ca + c4ab what is the number if 50% of 25% of the number is 96 Find the total cost or sale price to the nearest cent. Please solve and show all your work.A) A treadmill costs $2,199 with 6.3% sales tax.B) A shirt that costs $25 is on sale for 20% off. Help a playa out please ? Correct ans Which of the following is the substrate in the enzyme assay?A. 0.5% AzocaseinB. 2mg/mL TrypsinC. 0.15M NaCl + 20mM Tris-HCI solutionD. 10% TCA What is a plausible explanation for why elephants responded differently to ground and air signals? pls help me!Simplify [tex]2a * a * 3a + b * 4b[/tex] A car travels at 60.0 mph on a level road. The car has a drag coefficient of 0.33 and a frontal area of 2.2 m. How much power does the car need to maintain its speed? Take the density of air to be 1.29 kg/m. does anyone have an answer to this question? Write a polynomial function of least degree that has realcoefficients, the given zeros, and a leading coefficient of1, 1-2i, 1-sqrt(5)