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
masha68 [24]
3 years ago
14

2. Design a class named Sandwich with data fields for description and price. Include a constructor that requires arguments for b

oth fields and a method to display the data (example value for description is chicken). Create a subclass named Delivery Sandwich that inherits from Sandwich and has a delivery fee and a delivery address as additional fields. The description, price, and delivery address are required as arguments to the subclass constructor. The delivery fee should be set to $3 if the sandwich ordered costs more than $15; otherwise it should be set to $5. Write an application that instantiates at least two objects of each type and displays their state (data).
Computers and Technology
1 answer:
marta [7]3 years ago
5 0

Answer:

The answer files have been attached below, with the description of the files in the explanation.

Explanation:

The Sandwich class contains two functions

1) Sandwich() : A constructor that takes two arguments, the Description of sandwich and its price.

2) display_Data(): A function that does not take any arguments, and does not return anything. It prints the states (data of the variables Description, Price )

The Delivery Sandwich has three functions:

1) DeliverySandwich(): A constructor that takes in three arguments, Description of sandwich, Its price, and the delivery address.

super key word is used to access the parent class. super() is a method of calling the parent class's constructor. Description and price are passed to parent class's constructor, where as DeliveryAddress is initialized in the DeliverySandwich constructor.

It is then checked whether the price is greater than 15. If it is, the deliveryfee is set to 3, otherwise it is set to 5.

2) display_Data()

This is an overridden function. An overridden function in java is a function that has the same name as another function in its parent's class, but has different functionality.

The function first calls the display_Data() of the parent class using super.display_Data() to display the price and description of sandwich, then prints the address and delivery price of the sandwich

3) main()

Driver code that has objects of both sandwiches. Once an object is created, the display data function is called of each class to see the states of the variables in them.

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
You might be interested in
The term platform as a service has generally meant a package of security services offered by a service provider that offloads mu
Stells [14]

Answer:false

Explanation:

8 0
3 years ago
Which feature of presentation software is located under the Insert tab?
blondinia [14]

Answer:

Shapes

Explanation:

7 0
3 years ago
Read 2 more answers
I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
svlad2 [7]

Answer:

The answer is false

Explanation:

Please give me brainliest so I can post my artwork

6 0
4 years ago
What is not an advantage of a computer network?
Nutka1998 [239]

Answer:

C. Social Engineering

Explanation:

Social engineering can be defined as an art of manipulating people, especially the vulnerable to divulge confidential information or performing actions that compromises their security.

Basically, it is a manipulative strategy or technique that involves the use of deceptive and malicious activities on unsuspecting victims in order to gain unauthorized access to their confidential or private information for fraud-related purposes. Some examples of social engineering attacks include quid pro quo, spear phishing, baiting, tailgating, water-holing, vishing, pretexting, phishing, etc.

Phishing is an attempt to obtain sensitive information such as usernames, passwords and credit card details or bank account details by disguising oneself as a trustworthy entity in an electronic communication usually over the internet.

Furthermore, phishing is a type of fraudulent or social engineering attack used to lure unsuspecting individuals to click on a link that looks like that of a genuine website and then taken to a fraudulent web site which asks for personal information.

In conclusion, social engineering being a form of cyber attack is not an advantage of a computer network.

4 0
4 years ago
How do the following technologies help you with your quest to become a digital citizen kiosks enterprise computing, natural lang
Dafna11 [192]

Answer:

How could be an individual become a digital citizens?

Skills such as self-advocacy, conflict resolution, anger management, and decision-making skills, as well as the ability to use assertiveness, resistance, and refusal techniques, are also included and can help students respond safely and effectively online

Explanation:

SAlamat po pa rate nalang

5 0
2 years ago
Other questions:
  • If you were optimizing for performance and wanted to support potentially adding many new elements to an adt, then:
    12·1 answer
  • Because public key encryption requires the use of two different keys, it is also known as _____ encryption
    13·1 answer
  • if your instructors teaching style is very different from your learning preference your best choice is to one work on your weake
    10·1 answer
  • A field with the extend data type can contain an attached file, such as an image, document, chart, or spreadsheet.
    6·1 answer
  • Step 1: Configure the initial settings on R1. Note: If you have difficulty remembering the commands, refer to the content for th
    10·1 answer
  • Rachel wants to copy eight rows of data from one spreadsheet to another. She opens the spreadsheet, highlights the appropriate d
    15·2 answers
  • A total stranger is trolling Jack online. He’s offended and annoyed. How can Jack stop the troll in his or her tracks? (5 points
    10·2 answers
  • What is 3x10? PLZZZZZ
    11·1 answer
  • Marissa is designing a web page that features lessons on how to build cabinets. how can she make the page most engaging for the
    7·1 answer
  • Adding a border to an image is one way to manipulate media to spice up a project. Where do you find the Picture Styles command t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!