0% found this document useful (0 votes)
3 views

Using System

keren
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Using System

keren
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tugas1_Rainbow_Six
{
class Class1
{
static void Main(string[] args)
{
string nama;
char pilihan1,beli;
int n, pilihan, jumlah, total, harga, kelipatan;
inputmenu:

Console.Clear();
Console.Title = "ujian Ganjil";
Console.ForegroundColor = ConsoleColor.Yellow;

Console.WriteLine(new string('=', 30));


Console.WriteLine(new string(' ', 13) + "MENU");
Console.WriteLine(new string('=', 30));
Console.WriteLine("\n1.Pecabangan\n2.Perulangan\n3.Keluar");
Console.Write("\nPilih Menu [1/2/3] : ");
pilihan = int.Parse(Console.ReadLine());

Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Pilihan tidak valid!");
Console.Clear();
Console.ResetColor();

if (pilihan == 1)
{
inputMenuPenjualan:
Console.Clear();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(new string('=', 40));
Console.WriteLine(new string(' ', 13) + "Menu Penjualan");
Console.WriteLine(new string('=', 40));
Console.WriteLine("\n1.Nasi padang (Rp.12.000)\n2.Ikan gulai
(Rp.6.000)");
Console.Write("\nPilih Menu [1/2] : ");
pilihan = int.Parse(Console.ReadLine());

switch (pilihan)
{
case 1:
Console.Write("Masukkan jumlah pembelian : ");
jumlah = int.Parse(Console.ReadLine());
nama = "nasi padang";
harga = 12000;
total = harga * jumlah;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Terima kasih telah membeli " + nama + "
sejumlah " + jumlah + " pcs seharga Rp " + harga.ToString("N") + " dengan total Rp" +
total.ToString("N"));
break;
case 2:
Console.Write("Masukkan jumlah pembelian : ");
jumlah = int.Parse(Console.ReadLine());
nama = "ikan gulai";
harga = 6000;
total = harga * jumlah;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Terima kasih telah membeli " + nama + "
sejumlah " + jumlah + " pcs seharga Rp " + harga.ToString("N") + " dengan total Rp" +
total.ToString("N"));
break;
default:
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Pilihan tidak valid!");
Console.ReadKey();
goto inputMenuPenjualan;

}
goto inputlagi;
}
else if (pilihan == 2)
{
Console.Clear();
Console.Write("Masukkan kelipatan : ");
kelipatan = int.Parse(Console.ReadLine());
Console.Write("Masukkan n : ");
n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
Console.Write(kelipatan * i + "\t");
}
goto inputlagi;

}
else if(pilihan == 3)
{
Environment.Exit(0);
}

inputlagi:
Console.WriteLine("kembali ke daftar menu[Y/T]: ");
pilihan1 = char.Parse(Console.ReadLine());
if (pilihan1 == 'Y' || pilihan1 == 'y')
{
goto inputmenu;
}
else if (pilihan1 == 'T' || pilihan1 == 't')
{
Environment.Exit(0);
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Tidak valid");
Console.ReadKey();
goto inputlagi;
}

Console.ReadKey();

}
}
}

You might also like