-
Notifications
You must be signed in to change notification settings - Fork 0
/
rating04.go
40 lines (33 loc) · 1.04 KB
/
rating04.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
"time"
)
func main(){
var name string
var userRating string
//font end
//take name as input
reader := bufio.NewReader(os.Stdin)
fmt.Println("Please enter your full name:")
name, _ = reader.ReadString('\n')
//take rating from user and convert it to float
reader = bufio.NewReader(os.Stdin)
fmt.Println("Please rate our IT center between 1 and 5: ")
userRating, _ = reader.ReadString('\n')
mynumRating, _ := strconv.ParseFloat(strings.TrimSpace(userRating), 64)
//back end
// fmt.Printf("%v, %v", name, mynumRating)
fmt.Printf("Hello %v, \n Thanks for rating our IT center with %v star rating. \n\n Your rating was recorded in our system at %v", name, mynumRating, time.Now().Format(time.Stamp))
if mynumRating == 5 {
fmt.Println("Bonus for team for 5 star service")
} else if mynumRating == 4 || mynumRating == 3 {
fmt.Println("we are always improving")
} else if mynumRating < 3 {
fmt.Println("Need Serious work on our side")
}
}