Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in (pseudocode or flowchart) that calculates a customer’s availa

ID: 3686125 • Letter: W

Question

Write a program in (pseudocode or flowchart) that calculates a customer’s available credit. The program asks the user for the following: The customer’s name; The customer’s maximum amount of credit; The amount of credit used by the customer. Once those items have been entered, the program calculates the available credit. The program should display the customer’s name and his/her available credit. The available credit is calculated by subtracting the amount of credit used from the maximum amount of credit.

Change the program above to call, from the main method, a method to calculate the available credit. The method should receive the maximum amount of credit and the amount used; and the method should return the amount available. (The code to calculate the available credit should appear only in the method.)

Change the program to calculate the available credit for more than one customer, asking the user if (s)he wants to calculate the credit for another customer. (Hint: you will use loop)

Change the program to store each customer’s name in a String array, and each customer’s available credit in another array (use parallel arrays.)

PS: You can provide only one program including all items or separate codes.

Explanation / Answer

Steps to calculate customer Available credit

Program1:

in Main program()
step1: initialize 4 variables for total credit, credit used, credit available,customer name
step2: prompt user to input 3 values Total credit, credit used,customer name
step3: assign available credit = total credit-credit used
step4: print customername and available credit.

Program2:

in Main program()
step1: initialize 4 variables for total credit, credit used, credit available,customer name
step2: prompt user to input 3 values Total credit, credit used,customer name
step3: Declare one function with 2 parameters like double funcname(total credit, credit used)
step4: call this method with 2 values as parameters
step5: print customer name and value returned from called function

in Function()
Step1:assign available credit = total credit-credit used
step2: return available credit

Program3:

in Main program()
step1: initialize 5 variables for total credit, credit used, credit available,customer name,user choice='y'
step2: Declare one function with 2 parameters like double funcname(total credit, credit used)
step3: perform below steps in while loop until user choice not equal to 'N'
step4: prompt user to input 3 values Total credit, credit used,customer name
step5: call this method with 2 values as parameters
step6: print customer name and value returned from called function
step7: prompt user for his/her choice again and go to step 3.

in Function()
Step1:assign available credit = total credit-credit used
step2: return available credit


Program4:
in Main program()
step1: initialize 6 variables for total credit, credit used, credit available,customer name,user choice='y',counter i=0;
step2: declare 2 arrays one of type string for names and other for available credit of type double.
step3: Declare one function with 2 parameters like double funcname(total credit, credit used)
step4: perform below steps in while loop until user choice not equal to 'N'
step5: prompt user to input 3 values Total credit, credit used,customer name
step6: call this method with 2 values as parameters
step6: store name and available credit in respective array at position i and then increment i every time. i.e. nameArray[i]=name, creditArray[i]=available credit and i++
step8: prompt user for his/her choice again and go to step 4.

in Function()
Step1:assign available credit = total credit-credit used
step2: return available credit

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote