Question: Modify the following Go programs in the following ways: The Copy Cost Problem At the end of the customer output, ask the user if she

Modify the following Go programs in the following ways:

The Copy Cost Problem

  • At the end of the customer output, ask the user if she would like to go again
  • Have your program loop the inputs, calculations, and outputs for each customer
  • Use the Printf function to format your output
  • The spacing and formatting precision should exactly mirror that as shown below:

Enter customer name: Mark

Enter number of copies: 40

Customer name: Mark

Total cost: $Z.ZZ

Another customer (Y/N)? Y

Enter customer name: Jill

Enter number of copies: 150

Customer name: Jill

Total cost: $Z.ZZ

Another customer (Y/N)? Y

Enter customer name: Kerryon

Enter number of copies: 87

Customer name: Kerryon

Total cost: $Z.ZZ

Another customer (Y/N)? N

Program so far:

package main

import ( "fmt" ) func main() { var name string // variables var copies int var tprice int fmt.Println("Enter the customer name:")//get input //Get customer name fmt.Scanln(&name) fmt.Println(" Enter the Number of copies:")

//Get total number of copies fmt.Scanln(&copies) // calculate if(copies < 200){ tprice = (copies * 10) } else{ tprice=( 200*10)+(copies-200)*5 } //adds the additional cost fmt.Println(name, "'s total cost is", tprice," cents") }

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 Databases Questions!