Find the Error in each step.
1. //Superclass
public class Vehicle
{
(Member Declarations...)
}
//Subclass
public class car expands Vehicle
{
(Member declarations...)
}
2. //SuperClass
public class Vehicle
{
private double cost;
(Other methods...)
}
//Subclass
public class Car extends Vehicle
{
public Car(double c)
{
cost = c;
}
}
3. //Superclass
public class Vehicle
{
private double cost;
public Vehicle(double c)
{
cost = c;
}
(Other Nethods...)
}
//Subclass
public class Car extends Vehicle
{
private int passengers;
public Car(int p)
{
passengers = c;
}
(Other methods...)
}
4. //Superclass
public class Vehicle
{
public abstract double getMilesPerGallon( );
(Other methods...)
}
//Subclass
public class Car extends Vehicle
{
private int mpg;
public int getMilesPerGallon ( );
{
return mpg;
}
(Other methods...)
}

Answers

Answer 1

1. The keyword "expands" should be replaced with "extends" to properly indicate that the subclass "Car" inherits from the superclass "Vehicle".

2. The variable "cost" in the superclass "Vehicle" is declared as private, which means it cannot be accessed directly by the subclass "Car". To fix this, the variable should be declared as protected or a public getter and setter methods should be implemented.

3. In the constructor of the superclass "Vehicle", the closing parenthesis is missing after the assignment statement "cost = c;". It should be corrected by adding a closing parenthesis after "cost = c;".

4. In the subclass "Car", the method "getMilesPerGallon" should have a return type of "double" instead of "int" to match the abstract method in the superclass "Vehicle".

In the first step, there is a typo in the code where "expands" is used instead of the correct keyword "extends". The "extends" keyword is used to establish inheritance between classes in Java.

In the second step, the variable "cost" in the superclass "Vehicle" is declared as private. This means it cannot be accessed directly by the subclass "Car". To allow the subclass to access it, the variable should be declared as protected or public. Alternatively, getter and setter methods can be implemented in the superclass to provide controlled access to the variable.

In the third step, there is a missing closing parenthesis in the constructor of the superclass "Vehicle". This missing parenthesis causes a syntax error. Adding the closing parenthesis after the assignment statement "cost = c;" will resolve the error.

In the fourth step, the return type of the method "getMilesPerGallon" in the subclass "Car" should match the abstract method in the superclass "Vehicle". The superclass declares the method with a return type of "double", so the subclass should also have the same return type.

Learn more about superclass

brainly.com/question/15397064

#SPJ11


Related Questions

Which of the following statements is true of sans serif fonts?
A. Sans serif fonts provide a more creative look.
O B. Sans serif fonts are more decorative with additional curls and
loops.
C. Sans serif fonts set a more inviting and comforting tone.
D. Sans serif fonts are easier to read on a computer screen.

Answers

Answer:

The answer is D

Explanation:

I got it right

The statement that is true of sans serif fonts is that Sans serif fonts are easier to read on a computer screen.

What is font?

The word font is known to be a kind of different  printable text characters. e.g. f sans serif fonts

Based on the above, The statement that is true of sans serif fonts is that Sans serif fonts are easier to read on a computer screen.

Learn more about fonts from

https://brainly.com/question/1991747

#SPJ 2

Question # 6 Fill in the Blank You designed a program to create a username using the first three letters from the first name and the first four letters of the last name. You are testing your username program again for a user whose name is Paula Mano. The output should be

Answers

Its PuaMano

Explanation:

got it wrong and it shows this answer for edge

Write a program that uses an initializer list to store the following set of numbers in a list named nums. Then, print the first and last element of the list.

56 25 -28 -5 11 -6

Sample Run
56
-6

Answers

List and Print Elements.

Here's a possible implementation of the program in Python:

python

Copy code

nums = [56, 25, -28, -5, 11, -6]

print("First element:", nums[0])

print("Last element:", nums[-1])

The output of the program would be:

sql

Copy code

First element: 56

Last element: -6

In this program, we first define a list named nums using an initializer list with the given set of numbers. Then, we use indexing to access the first and last elements of the list and print them to the console. Note that in Python, negative indices can be used to access elements from the end of the list, so nums[-1] refers to the last element of the list.

ChatGPT

Sometimes an expansion board may have an extra PCIe power connector. This connector comes in what two different pin configurations?

Answers

Answer:

6-pin and 8-pin

Explanation:

The PCle power connector also known as PEG cables, makes extra power available to PCI Express cards. Mid power to high power graphic cards get their power to function from the PSU through the 6-pin and 8-pin PCI-Express PEG cables.

The 6-pin PEG cable graphics card supply capacity is 75 Watt such that a graphics card that requires 75 Watt will have a 6-pin PEG cable to supply its power needs

The 8-pin PEG cable graphics card supply capacity is 150 Watt such that a graphics card that requires 150 Watt will have an 8-pin PEG cable to supply its power needs.

Write a program to compute an employee's weekly pay and produce a pay slip showing name, gross, pay, deductions, and net pay. The program should first prompt the user for: a. Family name b. Given name c. Hourly rate of pay d. Number of hours worked that week (Any hours over 40 are paid at double the normal hourly rate) e. A letter indicating the employee's tax category A. No tax deduction B. Tax is 10% of gross pay C. Tax is 20% of gross pay D. Tax is 29% of gross pay E. Tax is 35% of gross pay f. Either a Y or an N to indicate whether or not the employee wants $20 deducted from the weekly pay as a contribution to the United Way Charity

Answers

Answer:

# get the employee data

family_name = input("Enter family name: ")

given_name = input("Enter given name: ")

hourly_rate = int(input("Enter hourly rate of pay: "))

hours = int(input("Enter hours worked for the week: "))

tax_cat = input("Enter tax category from a through e: ")

is_charit = input("Do you want to donate $20 to charity y/n: ")

gross_pay = 0

net_pay = 0

deductions = ""

# gross_pay

if hours > 40:

   gross_pay = hours * (2 * hourly_rate)

else:  

   gross_pay = hours * hourly_rate

# net_pay and deduction

if tax_cat == 'a':

   if is_charit == 'y':

       net_pay = gross_pay - 20

       deduction = "$20 charity donation"

   else:

       net_pay = gross_pay

       deduction = "0% tax"

elif tax_cat == 'b':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.1 * gross_pay) - 20

       deduction = "$20 charity donation and 10% tax"

   else:

       net_pay = gross_pay - (0.1 * gross_pay)

       deduction = "10% tax"

elif tax_cat == 'c':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.2 * gross_pay) - 20

       deduction = "$20 charity donation and 20% tax"

   else:

       net_pay = gross_pay - (0.2 * gross_pay)

       deduction = "20% tax"

elif tax_cat == 'd':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.29 * gross_pay) - 20

       deduction = "$20 charity donation and 29% tax"

   else:

       net_pay = gross_pay - (0.29 * gross_pay)

       deduction = "29% tax"

if tax_cat == 'e':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.35 * gross_pay) - 20

       deduction = "$20 charity donation and 35% tax"

   else:

       net_pay = gross_pay - (0.35 * gross_pay)

       deduction = "35% tax"

# output of the employee's weekly pay.

print(f"Employee name: {given_name} {family_name}")

print(f"Gross pay: ${gross_pay}")

print(f"Net pay: {net_pay}")

print(f"Deductions: {deduction}")

Explanation:

The python program uses the input built-in function to prompt and get user data for the program. The gross pay returns the total pay of the employee without any deduction while net pay returns the pay with all deductions included.

Which of the following statements are true about the growth of technology? Select 3 options. A. Individuals in the United States currently own an average of three connected devices. B. The general public began connecting to the Internet when the World Wide Web was introduced in 1991. C. By 1995, almost half of the world’s population was connected to the Internet. D. Currently, 67% of people on earth use at least one mobile device. E. The number of devices connected to the Internet of Things is expected to triple between 2018 and 2023.

Answers

Answer:

b

Explanation:

the general public began connecting to the internet when the world wide web was introduced

Answer:

The general public began connecting to the Internet when the World Wide Web was introduced in 1991.

By 1995, almost half of the world’s population was connected to the Internet.

Currently, 67% of people on earth use at least one mobile device.

Explanation:

which object-oriented programming principle creates and defines the permissions and restrictions of an oject and its member attributes and methods?

Answers

The OOPS concept of encapsulation is used to create and specify the permissions and limitations of an object, as well as the variables and methods that make up the object.

The object-oriented programming notion of abstraction "shows" only necessary properties and "hides" extraneous data. Abstraction serves the primary function of shielding users from pointless details. The four basic theoretical tenets of object-oriented programming are abstraction, encapsulation, polymorphism, and inheritance. Data and functions that change the data are bound together by the Object Oriented Programming notion of encapsulation, which protects both from outside intervention and misuse.

Learn more about programming here-

https://brainly.com/question/11023419

#SPJ4

what should the server do if they have any doubts regarding whether a patron is obviously intoxicated?

Answers

The server ensures the patron leaves within a reasonable period of time if they have any doubts regarding whether a patron is obviously intoxicated.

What are the strategies used to prevent intoxication?

The strategies that can be used in order to prevent intoxication are as follows:

Make water available and have staff offer it regularly to encourage patrons to pace their alcohol consumption. Encourage patrons to stop drinking or consume non-alcoholic drinks before they reach the point of undue intoxication. Lower the entertainment noise level to allow patrons to talk; this slows down drinking.

Once a patron becomes intoxicated, they must leave the premises and not be allowed back in. While they may have accepted your offer of a non-alcoholic drink, they will still need to leave.

To learn more about Intoxication, refer to the link:

https://brainly.com/question/13614186

#SPJ1

What can Amber do to make sure no one else can access her document? O Use password protection. O Add editing restrictions. O Use Hidden text. O Mark it as final.​

Answers

Add a password.

The question is asking how to make sure no one can “access” it which means look at it at all. This means that Editing restricting still allow people to access it, white text does nothing but make the text invisible, and marking it as final still gives them access
use password protection.

2.23 write the fast exponentiation routine without recursion. data structures & algorithm analysis

Answers

The fast exponentiation algorithm, also known as exponentiation by squaring, is a method to compute the power of a number efficiently. It can be implemented without recursion using a loop.

To implement the fast exponentiation algorithm without recursion, you can use a loop to iterate through the binary representation of the exponent. Starting with an initial result of 1, the loop squares the base number and multiplies it with the result if the corresponding bit in the exponent is set to 1.

The algorithm follows these steps:

Initialize the result to 1.

Convert the exponent to its binary representation.

Iterate through the binary representation from left to right.

Square the base number.

If the current bit is 1, multiply the result by the squared base.

After iterating through all the bits, the result will be the desired exponentiation.

This non-recursive implementation of the fast exponentiation algorithm allows for efficient calculation of large powers without the overhead of recursive function calls.

Learn more about exponentiation routine here: brainly.com/question/30902953
#SPJ11

30 points for this.
Any the most secret proxy server sites like “math.renaissance-go . Tk”?

Answers

No, there are no most secret proxy server sites like “math.renaissance-go . Tk”

What is proxy server sites

A proxy server functions as a mediator, linking a client device (such as a computer or smartphone) to the internet.  Sites operating as proxy servers, otherwise referred to as proxy websites or services, allow users to gain access to the internet using a proxy server.

By utilizing a proxy server site, your online activities are directed through the intermediary server before ultimately reaching your intended destination on the web.

Learn more about   proxy server sites from

https://brainly.com/question/30785039

#SPJ1

How to pass arguments in command line C?

Answers

Arguments can be passed in command line C by providing them after the name of the executable, separated by spaces. They can be accessed using the argc and argv variables.

Arguments can be passed in command line C by providing them after the name of the executable, separated by spaces. The first argument (argv[0]) is always the name of the program itself, while the subsequent arguments (argv[1], argv[2], etc.) are the user-provided inputs.

The number of arguments passed can be obtained using the argc variable. This variable holds an integer value that represents the number of command-line arguments passed, including the name of the program itself.

To access the individual arguments, the argv variable can be used. It is an array of strings that holds the actual argument values. The first element, argv[0], is always the name of the program, while subsequent elements contain the arguments provided by the user.

Learn more about command line C here:

https://brainly.com/question/830598

#SPJ4

A copyright is registered, while a trademark is____

Answers

Answer: Approved

Explanation: Copyright is generated automatically upon the creation of original work, whereas a trademark is established through common use of a mark in the course of business.

Why do companies collect information about consumers? A. Because they want to meet new friends on social networks B. Because they take consumers' best interests to heart C. Because they want to effectively advertise to consumers D. Because they are looking for good employees to hire​

Answers

Answer:

C. Because they want to effectively advertise to consumers.

Explanation:

Companies collect info for more accurate advertisements, which are designed to make people interact with them more commonly.

The photo shows a group of girls reacting to comments they have read about a classmate on a social media site. One girl stands by herself, looking sad. Four girls stand apart from her, looking at her and pointing. Two girls cover their mouths to hide a laugh. How might the girls react differently to best prevent cyberbullying? They could help their classmate report the comments to a teacher. They could promise to ignore the inappropriate comments. They could post inappropriate comments about other classmates on the site. They could remind their classmate that bullying is part of growing up.

Answers

Answer:

They could help their classmate report the comments to a teacher

Explanation:

Answer:

the answer is A

Explanation:

I did the test

a clock-in/out application, which uses an ntp server on the local network, is throwing an error concerning reaching the server. there are currently no network problems. which of the following are steps in the troubleshooting process for this issue?
A. -View firewall log entries.
B. -Check the /etc/services file for NTP ports and transport protocols.
C. -Check the firewall ACLs on the application server.
D. -Check the firewall ACLs on the NTP server.

Answers

In troubleshooting the clock-in/out application's error connecting to the local network's NTP server, the following steps should be taken: A, B, and D.

What steps should be taken to troubleshoot the clock-in/out application's issue with the local network's NTP server?

To troubleshoot the error with the clock-in/out application's connection to the local network's NTP server, there are several steps to follow.

First, viewing firewall log entries can provide insights into any potential blocks or restrictions that might be affecting the communication between the application and the NTP server.

Secondly, checking the `/etc/services` file for NTP ports and transport protocols ensures that the correct ports and protocols are being used for the NTP communication.

Finally, checking the firewall ACLs (Access Control Lists) on both the application server and the NTP server is essential, as these ACLs may be preventing the necessary network traffic from passing through.


Therefore, the following steps should be taken: A, B, and D.

Learn more about NTP server

brainly.com/question/30593430

#SPJ11

_____ are the culture-based "software programs" of the mind.

Answers

The answer is Cognitive Pragmatics

Fill in the blank with the correct response.
identifies switches, etc., at the other end of a network segment.

Answers

Answer:

Switches are network devices the connect network lines or segments together

Explanation:

\(.\)

what is the difference between windows 10 and windows 11

Answers

Answer: Windows 11 brings a brand-new, more Mac-like interface to the OS. It features a clean design with rounded corners and pastel shades. The iconic Start menu also moves to the centre of the screen along with the Taskbar. But you can move those back to the left, as they are in Windows 10, if you prefer.

Explanation:

Windows 11 will be a better operating system than Windows 10 when it comes to gaming. ... The new DirectStorage will also allow those with a high-performance NVMe SSD to see even faster loading times, as games will be able to load assets to the graphics card without 'bogging down' the CPU.


Avi does not want to save his internet browsing details on his computer. What should he do?
Avi should (copy,delete,or save) all the(virus,cookies,or logs) from his system after he has finished browsing.

Avi does not want to save his internet browsing details on his computer. What should he do?Avi should

Answers

He should delete logs.

It is true or false Nowadays computer games are mostly available on external hard disk.​

Answers

Answer:

false

Explanation:

because we're playing it on a mobile phone and a laptop than the hard disk. the hard disk is so old to use it nowadays.

assume that the boolean variable hot is assigned the value true and the boolean variable humid is assigned the value false. which of the following will display the value true ? select two answers.

Answers

To display the value "true" based on the given scenario, the following expressions would yield the desired result.

System.out.println(hot);

System.out.println(!humid);

The first option, System.out.println(hot);, directly prints the value of the boolean variable "hot," which is assigned the value true.

The second option, System.out.println(!humid);, uses the logical NOT operator (!) to negate the value of the boolean variable "humid." Since "humid" is assigned the value false, the negation (!) will result in true.

1. hot (This expression directly references the boolean variable hot, which has been assigned the value "true").

2. hot && !humid (This expression evaluates the logical conjunction (AND) between hot and the negation (NOT) of humid, resulting in "true" if hot is true and humid is false).

Both of these expressions will display the value "true" when executed.

Learn more about Boolean expressions here:

https://brainly.com/question/29025171

#SPJ11

Select the correct answer. In the decision-making process, after you have chosen the right solution, what is the next step? A. Act on your decision. B. Reflect on your decision. C. Gather information. D. Identify the problem. Reset Next

Answers

In the decision-making process, after you have chosen the right solution, the next step is to act on your decision.

How do you act on your decision?

A person act on their decision-making by putting those decision taken into use.

Therefore,  In the decision-making process, after you have chosen the right solution,  the next step is to Act on your decision as it entails bringing the decision to light.

Learn more about decision-making from

https://brainly.com/question/3432001

#SPJ1

In which job role would a course in 3D modeling help with professional career prospects?
A. computer programmer
B. multimedia artist
C. technical support specialist
D. web developer

Answers

B multimedia artist
B. Multimedia Artist

A photograph is created by what
A) Silver
B) Shutters
C) Light
4) Mirror

Answers

A photograph is created by Light.

What are photographs made of?

Any photograph created is one that is made up of Support and binders.

The steps that are needed in the creation of a photograph are:

First one need to expose or bring the film to light.Then develop or work on the imageLastly print the photograph.

Hence, for a person to create a photograph, light is needed and as such, A photograph is created by Light.

Learn more about photograph from

https://brainly.com/question/25821700

#SPJ1

What are three functions the modern day computers perform?

Answers

Answer:

Calculation

Research

Entertainment

Explanation:

It can help you with your math homework by calculating

You can do your E LA homework with research

You can listen to music or play games iron computer

what are some scams you should avoid when looking for a credit counselor?

Answers

Before any credit counseling services are offered, the company requires money.

What exactly does a credit advisor do?

Organizations that provide credit counseling can help you with your finances and bills, assist you with creating a budget, and provide training on money management. Its Fair Debt Collection Act's specific provisions have been clarified by the CFPB's debt recovery rule (FDCPA)

How is a credit counselor compensated?

Non-profit organizations typically obtain some funding to cover their costs from two sources: clients who pay to use their debt payback program and clients' creditors who agree to cover those costs as part of the credit counseling organization's negotiated agreements with creditors.

To know more about credit counselor visit:

https://brainly.com/question/15563363

#SPJ4

Match the terms with their explanations.

Match the terms with their explanations.

Answers

Answer:

Zoom helps move the object of view further or closer

White Balance tells the camera what each color should look like

Shutter controls how long light enters the camera

focus provides sharper images by way of a ring at the front of the lens

Explanation:

Took photography classes

Which of the following is NOT a legal variable name?
%information
appointment_hour
O grade3
firstName

Answers

0 grade3 is NOT because it’s not a variable name

Answer:

a

Explanation:

a

5 evaluation criteria

Answers

Answer:

relevance, efficiency, effectiveness, impact and sustainability. 

Other Questions
Which answer choice correctly represents 0.4121212?A) 0.412 _B) 0.412 __C) 0.412 ___D)0.412 What type of linear association does the graph show?Strong positiveWeak positiveStrong negativeWeak negative Reflect on how practicing your initiative skill in this course has made you a stronger communicator.Then, provide specific examples for how you have taken initiative in one of the areas below and explain how it has improved your communication in that area.Collaborating with others.Addressing interpersonal conflict.Presenting an articulate argument. Answer fast pleaseWhich statements hold true for the function?f(x)= 3x - 5Of(5)Of(0)=1Of(5) Does 20 25 15 make a right triangle? Can yall pls help me solve this? How can you factor expressions of the form ax2 + bx + c?Complete the answer.The sign of(select)tells you the signs of the constants and(select)tells you where to place those signs. Examine the factors of(select)to determine which factor pairs produce(select). Be sure to look for special patterns. Exercise 6 Place a check next to each sentence in which the adverb is positioned correctly.There are, however, quite some difficult jobs that are best left to a professional. Equivalent ExpressionsWrite three different but equivalentexpressionsEx:-2(3x -5) > -6x + 10 > -4+8-2x+2 what is x in the following equationy=3x-56x+3y=15 The ratio of the measures of the sides of atriangle is 3:4:6 and its perimeter is 91 inches.What is the length of the longest side? Identify what is being measured based on the unit: 120ml Which value of x makes the equation p 4=9 true?1327365 Ben has two gold color nuggets that look identical. However, the density of the first nugget is 4.2 g/mL and the second is 19.3 g/mL.Are the nuggets made out of the same substance? critically discuss how effective communication of values may help to build a sustainable relationship with your friends which environmental group is most closely associated with mountain climbing, backpacking, and camping? Help pls!Knowing how to find the surface area of a three-dimensional object can be useful in finding the amount of materials needed to make a box or the cost of materials to cover the surface area of a three-dimensional object.Jeremy makes a square pyramid out of paper. The measurements are shown. PLEASE HELP QUICK!! WILL GIVE BRAINLIEST AND 30 PTS!! how does setting affect the character of mrs. price in the passage? 10.RRECIBIZEIDSERLADSort the words You plan to make a total of 5 deposits of $14,000 each year with the first payment being made one year from today. The bank pays a nominal interest rate of 10% annually. How much your account with the bank be if you leave the money in the bank to be withdrawn all in 20 years from today?