A retail store grants its customers a maximum amount of credit. Each customer's available credit is his or her maximum amount of credit minus the amount of credit used. Write a pseudocode algorithm for a program that asks for a customer's maximum credit and amount of credit used, then calculates and displays the customer's available credit.

Short Answer

Expert verified
Answer: To calculate the available credit for a customer, subtract the credit used from the maximum credit (available_credit = max_credit - credit_used).

Step by step solution

01

Ask for the customer's maximum credit

First, we need to ask the customer for their maximum amount of credit. The input should be stored in a variable, let's call it max_credit.
02

Ask for the customer's amount of credit used

Next, we need to ask the customer for the amount of credit they have used so far. This input should be stored in another variable, let's call it credit_used.
03

Calculate the available credit

Now that we have the maximum credit and the credit used, we can calculate the available credit. To do this, subtract the credit used from the maximum credit: available_credit = max_credit - credit_used.
04

Display the available credit

Finally, we need to display the customer's available credit. To do this, simply output the available_credit variable. The pseudocode algorithm should look like this: 1. Ask for max_credit 2. Ask for credit_used 3. available_credit = max_credit - credit_used 4. Display available_credit

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Write a cout statement so the variable divsales is displayed in a field of eight spaces, in fixed-point notation, with a decimal point and two decimal digits.

include ; using namespace std; main { double number, half; cout \(<<\) "Enter a number and I will divide it $\backslash n^{\prime \prime}\( cout \)<<$ "in ha… # A) # include ; using namespace std; main { double number, half; cout \(<<\) "Enter a number and I will divide it \(\backslash n^{\prime \prime}\) cout \(<<\) "in half for you. \(\backslash n^{\prime \prime}\) $\operatorname{cin} \quad>>$ number 1 half \(=/ 2\) } B) \(\quad\) #include \(<\) iostream \(>\) using namespace std; int main ( ) \\{ char name, go cout \(<<\) "Enter your name: \("\) cin \(.\) width (20) cin. getline \(>>\) name cout \(<<\) "Hi \("<<\) name \(<<\) endl cout "Press the ENTER key to end this program." \(\operatorname{cin} \quad>>\operatorname{gof}\) return 0 \(f\)

Write a definition statement for a character array named city. It should be large enough to hold a string 30 characters in length.

Assume a program has the following variable definitions int \(a, b=2\) double \(c=4.3\) and the following statement: \(a=b * c\) What value will be stored in a?

inc… # Trace the following programs and tell what each will display. (Some require a calculator.) A) \(\text {(Assume the user enters } 38711 \text {. Use a calculator.})\) # include { iostream } using namespace std; int main ( ) \\{ double salary, monthly; cout \(<<\) "What is your annual salary? " \(\operatorname{cin} \quad>>\operatorname{salar} y\) month1y \(=\) static cast \(\langle\text { int }>(\text { salary ) } / 12\) cout \(<<\) "Your monthly wages are " \(<<\) monthly \(<<\) end1 return 0 B) #include using namespace std; int main () \\{ \\[ \begin{array}{l} \log g \quad x, \quad y, \quad z ; \\ x=y=z=4 \\ x+=2 \\ y-=1 ; \\ z \quad x=3 ; \\ \operatorname{cout}< using namespace std; # define WHO "Columbus" # define DID "sailed" #define WHAT "the ocean blue." int main () \\{ const int WHEN = 1492 cout \(<<\) "In \("<<\) WHEN \(<<\) " \("<<\) WHO \(<<\) " \\[ <

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free