Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

What is the general purpose of preliminary screening?

Answered: 1 week ago