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
Non-delivered goods, counterfeit products, fraudulent payments are common type of cyber crime these
Arisa [49]

Answer:

a. Internet auction fraud

b. Counterfeit products are products made and/or sold under the brand name of a product of a higher quality

c. 1) Monitor business transactions

2) Use an Address Verification System AVS

Explanation:

a. Such types of cyber crimes are collectively called Internet auction fraud

Internet or online auction fraud is a form of fraud that involves the act of providing misleading information about goods paced on advert for sale on an online auction site, including the sale of counterfeit goods, sale of goods of poor quality, receiving a different item from what was ordered, artificial bidding to increase price, omission of important information about a product, delivering an item that looks different from what was displayed on the website and the non-delivery of an item already to the buyer.

A seller can be a victim of the internet auction fraud when a buyer does not pay for goods an/or services received, request for delivery before payment, the buyer pays with a stolen credit card, the buyer uses a fake escrow account such that the money returns to the buyer after receiving the goods

b. Counterfeit products or goods are products that are being manufactured and marketed, without formal authorization, under the name of a popular and recognized but are usually of lesser quality than the product they try to imitate

c. Measures that can be taken to stop fraudulent payments are;

1) Monitor transactions to to check for red flags, including disparity in shipping and billing information

Monitor transactions from customer that use free or anonymous emails services which can easily be opened and closed without payment or proper  documentation

2) Make use of Address Verification System to authenticate the billing address on a payment, and the address on the credit card.

7 0
3 years ago
The ____ cell on the worksheet is the one into which you can enter data.â
Illusion [34]

I guess the best answer is Active.

The Active cell on the worksheet is the one into which you can enter data.

3 0
3 years ago
Read 2 more answers
True false you cannot fill in a callout​
Svetllana [295]
??????? Can you explain the question some more
8 0
3 years ago
"When a large data file needs to be processed in ascending or descending order based on a particular field, the most efficient a
Alona [7]

Answer:

Yes

Explanation:

For example, We need to write down the names of student in a school for survey purposes, rather than tell everyone to write their names on a sheet of paper and submit, we can instruct that names be written according to their classes and then written on the class sheets alphabetically.

Logically names will be written according to the classes from Class 1 - 10, then on the class sheet alphabetically from A - Z. its better represented that way for easy understanding and better collation and interpretation of data.

7 0
4 years ago
&gt;&gt;&gt; phrase = "abcdefgh" <br><br> &gt;&gt;&gt; phrase[3:6]
Scrat [10]

Answer:

Following are the correct code to this question:

phrase = "abcdefgh"#defining a variable phrase that holds a string value

print(phrase[3:6])#use print method for slicing and print its value

Output:

def

Explanation:

In the above code, a variable "phrase" is defined that holds a string value, and use a print method, inside the method, the variable is used as a list and use slicing.

It is a characteristic that enables you to access the series parts like strings, tuples, and lists. It also uses for modifying or removing objects in series, in the above slicing it starts from 3 and ends when it equal to the 6th letter, that's why it will print "def".

6 0
3 years ago
Other questions:
  • Which if the following is an example of tangible property?
    7·1 answer
  • If x is an int, which of the following statements adds 5 to the current value of x and stores the new value back in x?
    12·1 answer
  • A mobile base station (BS) in an urban environment has a power measurement of 15 µW at 175 m. If the propagation follows an inve
    9·1 answer
  • 9.18 LAB: Exact change - methods Write a program with total change amount as an integer input that outputs the change using the
    11·1 answer
  • What are the procedures use in installing a sound card
    12·1 answer
  • Identify the error and write correct HTML program 5 Cyber Bullying Tips&lt;\head&gt;Don't Respond Talk to a trusted adult &lt;|h
    14·1 answer
  • The function retrieveAt of the class arrayListType is written as a void function. Rewrite this function so that it is written as
    10·1 answer
  • List 10 ways how can graphic design help the community
    13·1 answer
  • Which of the statements below are true? Which are false?
    14·1 answer
  • This is a standard routine used to perform a mathematical task in excel is called?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!