Advertisement
Spocoman

Cruise Ship

Oct 6th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.30 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "bufio"
  6.   "os"
  7.   "strconv"
  8. )
  9.  
  10. func main() {
  11.     scanner := bufio.NewScanner(os.Stdin)
  12.    
  13.     scanner.Scan()
  14.     destination := scanner.Text()
  15.    
  16.     scanner.Scan()
  17.     cabinType := scanner.Text()
  18.    
  19.     scanner.Scan()
  20.     overnights,_ := strconv.Atoi(scanner.Text())
  21.    
  22.     dayPrice := 0.0
  23.  
  24.     if destination == "Mediterranean" {
  25.         if cabinType == "standard cabin" {
  26.             dayPrice = 27.50;
  27.         } else if cabinType == "cabin with balcony" {
  28.             dayPrice = 30.20
  29.         } else {
  30.             dayPrice = 40.50
  31.         }
  32.     } else if destination == "Adriatic" {
  33.         if cabinType == "standard cabin" {
  34.             dayPrice = 22.99
  35.         } else if cabinType == "cabin with balcony" {
  36.             dayPrice = 25.00
  37.         } else {
  38.             dayPrice = 34.99
  39.         }
  40.     } else {
  41.         if cabinType == "standard cabin" {
  42.             dayPrice = 23.00
  43.         } else if cabinType == "cabin with balcony" {
  44.             dayPrice = 26.60
  45.         } else {
  46.             dayPrice = 39.80
  47.         }
  48.     }
  49.  
  50.     totalSum := dayPrice * 4 * float64(overnights)
  51.    
  52.     if overnights > 7 {
  53.             totalSum *= 0.75
  54.     }
  55.  
  56.     fmt.Printf("Annie's holiday in the %s sea costs %.2f lv.\n", destination, totalSum)
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement