Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var weight, standardPrice, expressPrice float64
- fmt.Scanln(&weight)
- var service string
- fmt.Scanln(&service)
- var distance int
- fmt.Scanln(&distance)
- if weight < 1 {
- standardPrice = 0.03
- } else if weight >= 1 && weight < 10 {
- standardPrice = 0.05
- } else if weight >= 10 && weight < 40 {
- standardPrice = 0.10
- } else if weight >= 40 && weight < 90 {
- standardPrice = 0.15;
- } else if weight >= 90 && weight < 150 {
- standardPrice = 0.20;
- }
- if service == "express" {
- if weight < 1 {
- expressPrice = standardPrice * 0.80
- } else if weight >= 1 && weight < 10 {
- expressPrice = standardPrice * 0.40
- } else if weight >= 10 && weight < 40 {
- expressPrice = standardPrice * 0.05
- } else if weight >= 40 && weight < 90 {
- expressPrice = standardPrice * 0.02
- } else if weight >= 90 && weight < 150 {
- expressPrice = standardPrice * 0.01
- }
- }
- totalPrice := standardPrice * float64(distance) + expressPrice * float64(distance) * weight;
- fmt.Printf("The delivery of your shipment with weight of %.3f kg. would cost %.2f lv.\n", weight, totalPrice);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement