Advertisement
Spocoman

07. Hotel Room

Sep 18th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.95 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var month string
  6.     fmt.Scanln(&month)
  7.  
  8.     var nights int
  9.     fmt.Scanln(&nights)
  10.    
  11.     var apartmentPrice = 0.0
  12.     var studioPrice = 0.0
  13.  
  14.     if (month == "May" || month == "October") {
  15.         apartmentPrice = 65
  16.         studioPrice = 50
  17.         if (nights > 7 && nights <= 14) {
  18.             studioPrice *= 0.95
  19.         } else if (nights > 14) {
  20.             studioPrice *= 0.70
  21.         }
  22.     } else if (month == "June" || month == "September") {
  23.         apartmentPrice = 68.70
  24.         studioPrice = 75.20
  25.         if (nights > 14) {
  26.             studioPrice *= 0.80
  27.         }
  28.     } else if (month == "July" || month == "August") {
  29.         apartmentPrice = 77
  30.         studioPrice = 76
  31.     }
  32.  
  33.     if (nights > 14) {
  34.         apartmentPrice *= 0.9
  35.     }
  36.    
  37.     fmt.Printf("Apartment: %.2f lv.\nStudio: %.2f lv.\n", apartmentPrice * float64(nights), studioPrice * float64(nights))
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement