Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 3 (7 MARKS) Write a program which simulates four transactions on a Visa credit card account. Initially the account has a balance of-$113. Each

image text in transcribed

image text in transcribed

image text in transcribed

QUESTION 3 (7 MARKS) Write a program which simulates four transactions on a Visa credit card account. Initially the account has a balance of-$113. Each transaction is either a negative amount (a credit card purchase) or a positive amount (a payment). The amount of each transaction (purchase or payment) is a random integer between 15 and 200 inclusive. Below are the three statements which initialise the variables. Copy and paste them into your program. initial balance-113 transaction min15 transaction max 201 #1 bigger than the maximum In the output, the amount of each transaction is displayed inside parentheses following the balance (after the transaction has been applied). The final two lines of output show the final balance and the overall sum of the four transactions. Note that there are 35"symbols in the two lines enclosing the final two lines of output. Hint: in order to create a transaction which is either a purchase or a payment you will find it useful to generate a random number which is either-1 or 1The random transaction amount is then multiplied by this number Below are two example outputs using the completed program. Your program must give a correct output in exactly the same format as the outputs in the two examples below: Initial visa balance(dollars):-11.3 1 294 (-181) 2: -119 (175) 3 65 (184) 4 254 (189) Final Visa balance (dollars) : 254 Sum of transactionst $367 Initial Visa balance (dollars113 1 -295 (-182) 2 -274 (21) -129 (145) -289 (-160) Final Visa balance (dollars) :-289 Sum of transactions: $-176

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

Students also viewed these Databases questions