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
notsponge [240]
3 years ago
13

Develop a C++ program that will determine whether a department store customer has exceeded the credit limit on a charge account.

For each customer, the following are available: 1. Account number (integer) 2. Balance at the beginning at the month 3. Total of all items charged by this customer this month 4. Total of all credits applied to this customer’s account this month 5. Allowed credit limit The program should use a while statement to input each of these facts, calculate the new balance (=beginning balance + charges – credits) and determine whether the new balance exceeds the customer’s credit limit. For those customers whose credit limit is exceeded, the program should display the customer’s account number, credit limit, new balance and the message "Credit Limit Exceeded"
Computers and Technology
1 answer:
harina [27]3 years ago
3 0

Answer:

#include <iostream> // For including input output functions

using namespace std; // used by computer to identify cout cin endl

int main() { start of the body of main function

 int Account_Number; // stores the account number

double starting_balance; //stores beginning balance

double total_charges; // stores all items charged

double total_credit; // stores total credits applied to customers account

double credit_limit; // stores allowed credit limit

double new_balance; //stores the  new balance

while( Account_Number != -1 ) // loop continues until acc no is -1

{    cout<<"Please Enter The Account Number " ;

//prompts the user to enter the account number

  cin>>Account_Number; // reads account number

   cout<< "Please Enter Beginning Balance: " ;

   cin>>starting_balance ; //reads beginning balance

   cout<< "Please Enter the Total Charges: " ;

   cin>>total_charges; //reads total charges

  cout<< "Please Enter Total Credits: " ;

   cin>>total_credit; // reads total credits

   cout<< "Please Enter Credit Limit: " ;

   cin>>credit_limit ; //reads credit limit

// calculates the new balance

   new_balance = starting_balance + total_charges - total_credit;

// checks if the new balance exceeds customers credit limit

   if ( new_balance > credit_limit ) {

/* if the credit limit is exceeded, the program displays the customer’s account number, credit limit, new balance and the message "Credit Limit Exceeded */

    cout<< "Account Number:"<<Account_Number<<endl;

     cout<< "Credit Limit:"<< credit_limit<<endl;

    cout<< "New Balance:"<<new_balance<<endl;

     cout<< "Credit Limit Exceeded."<<endl ;    }

   cout << "Please Enter Account Number (-1 to end): "<<endl;

 cin >> Account_Number;}  }  

Explanation:

This program calculates the new balance by adding beginning balance and total charges and subtracting total credits applied to the customer from starting balance and total charges. If statement is used here to check the condition if the new balance exceeded the credit limit. If this is true then the program displays customer’s account number, credit limit, new balance and the message "Credit Limit Exceeded. While loop here will continue to execute until the user enters -1.

You might be interested in
How would you write this using Java: Use a TextField's setText method to set value 0 or 1 as a string?
katrin [286]

Answer:

Explanation:

The following Java code uses JavaFX to create a canvas in order to fit the 10x10 matrix and then automatically and randomly populates it with 0's and 1's using the setText method to set the values as a String

import javafx.application.Application;

import javafx.scene.Scene;

import javafx.scene.control.TextField;

import javafx.scene.layout.GridPane;

import javafx.stage.Stage;

public class Main extends Application {

   private static final int canvasHEIGHT = 300;

   private static final int canvasWIDTH = 300;

   public void start(Stage primaryStage) {

       GridPane pane = new GridPane();

       for (int i = 0; i < 10; i++) {

           for (int j = 0; j < 10; j++) {

               TextField text = new TextField();

               text.setText(Integer.toString((int)(Math.random() * 2)));

               text.setMinWidth(canvasWIDTH / 10.0);

               text.setMaxWidth(canvasWIDTH / 10.0);

               text.setMinHeight(canvasHEIGHT / 10.0);

               text.setMaxHeight(canvasHEIGHT / 10.0);

               pane.add(text, j, i);

           }

       }

       Scene scene = new Scene(pane, canvasWIDTH, canvasHEIGHT);

       primaryStage.setScene(scene);

       primaryStage.setMinWidth(canvasWIDTH);

       primaryStage.setMinHeight(canvasHEIGHT);

       primaryStage.setTitle("10 by 10 matrix");

       primaryStage.show();

   }

   public static void main(String[] args) {

       Application.launch(args);

   }

}

3 0
2 years ago
Complete the do-while loop to output every number form 0 to countLimit using printVal. Assume the user will only input a positiv
elena-s [515]

Answer:

PART ONE

  1. import java.util.Scanner;
  2. public class CountToLimit {
  3.    public static void main(String[] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        int countLimit = 0;
  6.        int printVal = 0;
  7.        // Get user input
  8.        System.out.println("Enter Count Limit");
  9.        countLimit = scnr.nextInt();
  10.        do {
  11.            System.out.print(printVal + " ");
  12.            printVal = printVal + 1;
  13.        } while ( printVal<=countLimit );
  14.        System.out.println("");
  15.        return;
  16.    }
  17. }

PART TWO

  1. import java.util.Scanner;
  2. public class NumberPrompt {
  3.    public static void main (String [] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        System.out.print("Your number < 100: ");
  6.       int  userInput = scnr.nextInt();
  7.      do {
  8.           System.out.print("Your number < 100: ");
  9.           userInput = scnr.nextInt();
  10.       }while (userInput>=100);
  11.        System.out.println("Your number < 100 is: " + userInput);
  12.        return;
  13.    }
  14. }

Explanation:

In Part one of the question, The condition for the do...while loop had to be stated this is stated on line 14

In part 2, A do....while loop that will repeatedly prompt user to enter a number less than 100 is created. from line 7 to line 10

7 0
2 years ago
The game begins with the player having 20 POINTS
kompoz [17]

Answer:

Following are the code to this question:

import random#import package for using random method  

def rolling_dice(): #defining method rolling_dice that uses a random number to calculate and add value in dice1 and dice2 variable

   dice1 = random.randint(1,6)

   dice2 = random.randint(1,6)

   return dice1 + dice2

def rolling(): # defining method rolling

   n_roll = 0  # defining num variable that initial value that is 0.

   p = 20 # defining variable p for looping, that points in between 1 and 59

   while p > 0 and p < 60: # defining loop that counts value dice value two times  

       d = rolling_dice()#defining d variable that hold method value

       n_roll+= 1 #defining n_roll that increment n_roll value by 1

       if d == 7 or d == 11:# defining if block that uses the d variable that checks either 7 or 11, player won d in p variable

           p+= d   # use p variable that adds d variable

       elif d == 2 or d == 3 or d == 12:#defining elif block to that checks d variable by using or operator  

           p-= d#defining d variable that decreases d variable variable

       else: # defining else block

           p1 = d # using p1 variable that store d value  

           while True:# defining loop that calculates values

               d = rolling_dice()#defining d variable that holds method values

               n_roll += 1 #increment the n_roll value by 1

               if d == 7:#defining if block that checks d value equal to 7

                   p -= p1#subtract the value of p1 in p variable  

                   break # exit loop

               elif d == p:#defining elif block to check d value is equal to p

                   p += p1#adds the value of p1 in p variable  

                   break#using break keyword

   if p<= 0:#defining if block that checks p-value is less then equal to 0  

       print('Player lost')#using print method

   elif p>= 60:#defining else block that checks p-value is greater than equal to 60

       print('Player won')#using print method to print the value

   print('number of dice rolls:', n_roll)#use print method to print n_rolls value

rolling()

Output:

Player lost

number of dice rolls: 38

Explanation:

In the above-given python code, a method "rolling_dice" is declared, inside the method two-variable "dice1 and dice2" is declared, that uses the random method to calculate the value in both variable and use the return keyword to add both values.

  • In the next step, another method the "rolling"  is declared, inside the method "n_roll and p" is declared that assigns the values and use the two while loop, inside the loop if block is defined that calculates the values.
  • In the next step, a condition block is used that stores value in the p variable and use the print method to print the "n_roll" value.  
8 0
3 years ago
In the world of computing,accessibility MOST often refers to what
Nutka1998 [239]

<span>Accessibility refers to access to some form of computer technology. This means that numbers are easily organized and data is easily calculated making it easier for people’s lives. It is a means of an efficient and more productive existence in the work environment.</span>

5 0
2 years ago
Jim, the IT director, is able to complete IT management task very well but is usually two weeks late in submitting results compa
oee [108]

Answer:Effective but not efficient

Explanation:

Jim is effective because he was able to complete the IT tasks well but he is not efficient because he didn't submit the result on time because being efficient includes management of time.

5 0
3 years ago
Other questions:
  • What office application has animations on the home ribbon?
    7·2 answers
  • Anna always has a hard time finding files on her computer because she does not know where she saved them. This also affects her
    12·2 answers
  • Describe how using active listening at work can help you be a better employee.
    15·1 answer
  • Face book requires you to change your password regularly<br> a. TRUE<br> b. FALSE
    14·1 answer
  • Write a program to calculate and return total surface area of a box using FUNCTION _END FUNCTION.​
    15·1 answer
  • What is the missing line of code?
    10·2 answers
  • Who has gotten a random file link from someone? What file does it contain?
    8·2 answers
  • Hey guys, I don’t have a problem for you but If anyone knows do you still pass your grade level if you failed 1 class in the las
    11·2 answers
  • Imagine that you need to prepare for three end-of-term tests. What steps will you take to make sure your study time is well spen
    5·1 answer
  • The layer of the ISO/OSI responsible for source to destination delivery.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!