Question: I have this programming task below and was wondering if anybody could help there is a problem at the bottom which is what i need

I have this programming task below and was wondering if anybody could help there is a problem at the bottom which is what i need to understand how to do.

Case study: A Go Card account maintains a balance that may be spent on public transport.

Users may request a statement that shows all transactions. The only transactions are to top

up the account with some positive number of dollars, and to take a ride costing some dollars and cents. The goal for this exercise is to develop a class for a Go Card Account.

The class will be tested by a program that simulates transactions, like this:

Creating account. Input initial balance: 100

? r 3.50

? r 10.90

? b

Balance = $85.60

? t 20

? x gghhg

1

Bad command.

? t

Bad command.

? q

Statement:

event amount ($) balance ($)

Initial balance 100.00

Ride 3.50 96.50

Ride 10.90 85.60

Top up 20.00 105.60

Final balance 105.60

Where:

r number simulates a ride costing number dollars;

t number simulates a top up of number dollars;

b requests the current balance; and

q ends input and prints a statement.

Bad inputs are to be reported and ignored.

Problem 1

Problem: Implement the program described above, leaving out the printing of a full statement at the end.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!