Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var days int
- fmt.Scanln(&days)
- nights := days - 1
- var typee, rating string
- fmt.Scanln(&typee)
- fmt.Scanln(&rating)
- price := 0.0
- if nights > 0 {
- if typee == "room for one person" {
- price = 18.00;
- } else if typee == "apartment" {
- price = 25.00
- if nights < 10 {
- price *= 0.70
- } else if nights > 15 {
- price *= 0.50
- } else {
- price *= 0.65
- }
- } else {
- price = 35.00
- if nights < 10 {
- price *= 0.90
- } else if nights > 15 {
- price *= 0.80
- } else {
- price *= 0.85
- }
- }
- if rating == "positive" {
- price *= 1.25
- } else {
- price *= 0.90
- }
- }
- fmt.Printf("%.2f\n", price * float64(nights))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement