-
Notifications
You must be signed in to change notification settings - Fork 5
/
TipCalculator.cs
35 lines (31 loc) · 879 Bytes
/
TipCalculator.cs
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
using UnityEngine;
namespace Section.Variables.Challenge03
{
public class TipCalculator : MonoBehaviour
{
/// Challenge Overview:
///
/// 01: Use the following data:
///
/// bill of $40
/// tip is 20% or User input
/// Calculate total
///
/// 02: Print message to user:
///
/// Your bill is:__ and you tip amount is:__ Total due:__
///
public int bill = 40;
public float tip = 20.0f;
public float totalAmount;
// Use this for initialization
void Start()
{
float tipAmount = bill * (tip / 100);
totalAmount = bill + tipAmount;
Debug.Log("Bill: " + bill);
Debug.Log("Tip: " + tipAmount);
Debug.Log("Total: " + totalAmount);
}
}
}