Advertisement
Spocoman

04. Car To Go

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