Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "bufio"
- "os"
- "strconv"
- )
- func main() {
- scanner := bufio.NewScanner(os.Stdin)
- scanner.Scan()
- destination := scanner.Text()
- scanner.Scan()
- cabinType := scanner.Text()
- scanner.Scan()
- overnights,_ := strconv.Atoi(scanner.Text())
- dayPrice := 0.0
- if destination == "Mediterranean" {
- if cabinType == "standard cabin" {
- dayPrice = 27.50;
- } else if cabinType == "cabin with balcony" {
- dayPrice = 30.20
- } else {
- dayPrice = 40.50
- }
- } else if destination == "Adriatic" {
- if cabinType == "standard cabin" {
- dayPrice = 22.99
- } else if cabinType == "cabin with balcony" {
- dayPrice = 25.00
- } else {
- dayPrice = 34.99
- }
- } else {
- if cabinType == "standard cabin" {
- dayPrice = 23.00
- } else if cabinType == "cabin with balcony" {
- dayPrice = 26.60
- } else {
- dayPrice = 39.80
- }
- }
- totalSum := dayPrice * 4 * float64(overnights)
- if overnights > 7 {
- totalSum *= 0.75
- }
- fmt.Printf("Annie's holiday in the %s sea costs %.2f lv.\n", destination, totalSum)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement