Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "bufio"
- "fmt"
- "os"
- "strconv"
- )
- func main() {
- scanner := bufio.NewScanner(os.Stdin)
- scanner.Scan()
- town := scanner.Text()
- scanner.Scan()
- pack := scanner.Text()
- scanner.Scan()
- vip := scanner.Text()
- scanner.Scan()
- days,_ := strconv.Atoi(scanner.Text())
- if days > 7 {
- days--
- }
- dayPrice := 0.0
- if town == "Bansko" || town == "Borovets" {
- if pack == "withEquipment" {
- dayPrice = 100
- if vip == "yes" {
- dayPrice *= 0.90
- }
- } else if pack == "noEquipment" {
- dayPrice = 80
- if vip == "yes" {
- dayPrice *= 0.95
- }
- }
- } else if town == "Varna" || town == "Burgas" {
- if pack == "withBreakfast" {
- dayPrice = 130
- if vip == "yes" {
- dayPrice *= 0.88
- }
- } else if pack == "noBreakfast" {
- dayPrice = 100
- if vip == "yes" {
- dayPrice *= 0.93
- }
- }
- }
- if days < 1 {
- fmt.Println("Days must be positive number!")
- } else if dayPrice > 0 {
- fmt.Printf("The price is %.2flv! Have a nice time!", dayPrice * float64(days))
- } else {
- fmt.Println("Invalid input!")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement