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
ruslelena [56]
4 years ago
7

Write a program to implement the algorithm that you designed in Exercise 21 of Chapter 1. Your program should allow the user to

buy as many items as the user desires.
Reference:

The number in parentheses at the end of an exercise refers to the learning objective listed at the beginning of the chapter.

Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at one time, is $200 or more, then the shipping and handling is free; otherwise, the shipping and handling is $10 per item. Design an algorithm that prompts Jason to enter the number of items ordered and the price of each item. The algorithm then outputs the total billing amount. Your algorithm must use a loop (repetition structure) to get the price of each item. (For simplicity, you may assume that Jason orders no more than five items at a time.) (9)
Computers and Technology
1 answer:
Murrr4er [49]4 years ago
4 0

Answer:

total = 0

items = int(input("Enter the number of items ordered: "))

for i in range(items):

   price = float(input("Enter the price of item " + str(i+1) + ": "))

   total += price

if total < 200:

   total += (items * 10)

   

print("Bill is $" + str(total))

Explanation:

*The code is in Python.

Ask the user to enter the number of items ordered

Create a for loop that iterates depending on the number of items ordered. Inside the loop, ask the price of each item and add it to the total

After the loop, check the total. If it is smaller than 200, add 10 for each item to the total

Print the total

You might be interested in
A computer application such as Microsoft Access that is used to store data and convert it into information is a ________________
lorasvet [3.4K]
All data is stored in table
5 0
4 years ago
It is the "executable" phrase of Word<br>Wide Web with dynamic applications,?<br>​
Mkey [24]

Answer:

It is the “executable” phrase of Word Wide Web with dynamic applications, interactive services, and “machine-to-machine” interaction. In Web 3.0, computers can interpret information like humans and intelligently generate and distribute useful content tailored to the needs of users.

4 0
3 years ago
For a parking application that lets you pay for parking via your phone, which of these is an example of a functional requirement
IgorLugansk [536]

Answer:

b. displaying hourly costs

Explanation:

Displaying hourly costs would be very useful for parking staff because it would allow customers to understand how the charge for the service was made, without the need for an employee to have to explain it. In this way, work becomes less stressful and more optimized.

6 0
3 years ago
a) (20 points) Define the method inDogish recursively such that it returns true if the word is in dog-ish and false if it is not
tia_tia [17]

Answer:

/ Main.java

class Main {

     public static void main(String[] args) {

           //System.out.println(inDogish("aplderogad"));

           //System.out.println(inXish("aplderogad", "dog"));

     }

     // returns true if the word is in dog-ish

     // returns false if word is not in dog-ish

     public static boolean inDogish(String word) {

           /**

           * Note: we can use the inXish() method to complete this method in a

           * single line if you want. just write 'return inXish(word,"dog");' and

           * you are done.

           */

           // if word is null or empty, returning false

           if (word == null || word.length() == 0) {

                 return false;

           }

           // converting word to lower case

           word = word.toLowerCase();

           // if 'd' does not exist on the word, returning false

           if (!dogishHelper(word, 'd')) {

                 return false;

           }

           // removing the characters upto first 'd' in word

           word = word.substring(word.indexOf('d') + 1);

           // if 'o' does not exist on the word, returning false

           if (!dogishHelper(word, 'o')) {

                 return false;

           }

           // removing the characters upto first 'o' in word

           word = word.substring(word.indexOf('o') + 1);

           // if 'g' does not exist on the word, returning false, otherwise

           // returning true

           if (!dogishHelper(word, 'g')) {

                 return false;

           } else {

                 return true;

           }

     }

     // necessary to implement inDogish recursively.

     // returns true if letter is in word, else not.

     public static boolean dogishHelper(String word, char letter) {

           // if word is empty, returning -1

           if (word == null || word.length() == 0) {

                 return false;

           }

           // if first character in word is letter, returning 0

           if (word.charAt(0) == letter) {

                 return true;

           }

           return dogishHelper(word.substring(1), letter);

     }

     // the best thing about the above helper method is that we can use it in

     // inXish method also

     // a generalized version of the inDogish method

     public static boolean inXish(String word, String x) {

           // if x is empty, returning true (base case, which means all the letters

           // in x are in word in that order)

           if (x.length() == 0) {

                 return true;

           }

           // getting first character of x

           char first = x.charAt(0);

           // if first character does not exist on the word, returning false

           if (!dogishHelper(word, first)) {

                 return false;

           }

           // calling and returning inXish recursively, passing the word after

           // removing characters upto first occurrance of char first, and x after

           // removing first character from it

           return inXish(word.substring(word.indexOf(first) + 1), x.substring(1));

     }

}

Explanation:

7 0
4 years ago
Which option helps you adjust column width to match the text?
torisob [31]
<span>auto-fit is the answer perhaps</span>
7 0
3 years ago
Other questions:
  • Security testing attempts to verify that protection mechanisms built into a system protect it from improper penetration.
    9·1 answer
  • Suppose you have an int variable called number. What Java expression produces the second-to-last digit of the number (the 10s pl
    13·1 answer
  • Kwan is using JavaScript extensively to add interactivity to his Web site. Contained within his script is a counter object that
    8·1 answer
  • 1. Write a program that asks the user to enter a string. The program should then print the following: (a) The total number of ch
    11·1 answer
  • Convert the ProjectedRaises class to an interactive application named ProjectedRaisesInteractive. Instead of assigning values to
    15·1 answer
  • The programs in a computer are called
    7·1 answer
  • Please tell fast plzzzzzzzz​
    11·2 answers
  • Why should the Six-Step Process be considered as an iterative process?
    8·1 answer
  • Do you know how to change your grades on a printer???????????
    13·1 answer
  • HURRY please!!!!
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!