Advertisement
Spocoman

Car To Go

Oct 3rd, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.73 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var budget float64
  7.     fmt.Scanln(&budget)
  8.    
  9.     var season string
  10.     fmt.Scanln(&season)
  11.    
  12.     car := "Jeep"
  13.     carClass := "Luxury class"
  14.  
  15.     if budget > 500 {
  16.         budget *= 0.90
  17.     } else if budget > 100 {
  18.         if season == "Summer" {
  19.            car = "Cabrio"
  20.             budget *= 0.45
  21.         } else {
  22.             budget *= 0.80
  23.         }
  24.         carClass = "Compact class"
  25.     } else if budget > 0 {
  26.         if season == "Summer" {
  27.             car = "Cabrio"
  28.             budget *= 0.35
  29.         } else {
  30.             budget *= 0.65
  31.         }
  32.         carClass = "Economy class"
  33.     }
  34.  
  35.     fmt.Printf("%s\n%s - %.2f\n", carClass, car, budget)
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement