Advertisement
Spocoman

Travel Agency

Oct 14th, 2024
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.38 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "bufio"
  5.     "fmt"
  6.     "os"
  7.     "strconv"
  8. )
  9.  
  10. func main() {
  11.     scanner := bufio.NewScanner(os.Stdin)
  12.     scanner.Scan()
  13.     town := scanner.Text()
  14.    
  15.     scanner.Scan()
  16.     pack := scanner.Text()
  17.    
  18.     scanner.Scan()
  19.     vip := scanner.Text()
  20.    
  21.     scanner.Scan()
  22.     days,_ := strconv.Atoi(scanner.Text())
  23.     if days > 7 {
  24.         days--
  25.     }
  26.  
  27.     dayPrice := 0.0
  28.  
  29.     if town == "Bansko" || town == "Borovets" {
  30.         if pack == "withEquipment" {
  31.             dayPrice = 100
  32.             if vip == "yes" {
  33.                 dayPrice *= 0.90
  34.             }
  35.         } else if pack == "noEquipment" {
  36.             dayPrice = 80
  37.             if vip == "yes" {
  38.                 dayPrice *= 0.95
  39.             }
  40.         }
  41.     } else if town == "Varna" || town == "Burgas" {
  42.         if pack == "withBreakfast" {
  43.             dayPrice = 130
  44.             if vip == "yes" {
  45.                 dayPrice *= 0.88
  46.             }
  47.         } else if pack == "noBreakfast" {
  48.             dayPrice = 100
  49.             if vip == "yes" {
  50.                 dayPrice *= 0.93
  51.             }
  52.         }
  53.     }
  54.  
  55.     if days < 1 {
  56.         fmt.Println("Days must be positive number!")
  57.     } else if dayPrice > 0 {
  58.         fmt.Printf("The price is %.2flv! Have a nice time!", dayPrice * float64(days))
  59.     } else {
  60.         fmt.Println("Invalid input!")
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement