Hello I need help on editing the project below. I would ask the user if they wou
ID: 3824068 • Letter: H
Question
Hello I need help on editing the project below.
I would ask the user if they would like to sign up to our membership program or if they have an account already. If they say they have an account we would then get an input and compare it to the array. Max membership is 100
I would like to include a membership system were the user would sign up by inputing their name, address, email and phone number. This would be saved into an array we have to make sure we are inputing the information into an empty array by using a search algorithm.
We will ask the user for the day. I would also like to include a daily special deal that picks out a random number from 1-7 depending on the day and give out a special 3% off on Monday-Wed // 5% off Thurs-Sat and 10% off on Sundays.
At the end of the program we would include a short 5 question survey.
Don't worry about making the program short. I need 1000 lines of code for this program.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace check1
{
class Program
{
static void Main(string[] args)
{
double bill = 0.0;
int i;
bool flag = true;
while(flag)
{
Console.Write("********************************** ");
Console.Write("* Welcome to Alonzos Coffee Shop! * * What would you like to order? * * 1. Coffe ($1.50) * * 2. Latte ($2.00) * * 3. Pastry ($1) * * 4. Exit * ");
Console.Write("********************************** ");
i = int.Parse(Console.ReadLine());
if (i==1)
{
bill = bill + 1.50;
Console.Write(" * You selected Coffee * * What would you like to add any items? * * 1. Sugar * * 2. Milk * * 3. Creamer * * 4. Return to the main menu * ");
int m;
m=int.Parse(Console.ReadLine());
switch(m)
{
case 1 : Console.Write("You added Sugar ");
break;
case 2 : Console.Write("You added Milk ");
break;
case 3 : Console.Write("You added Creamer ");
break;
case 4 : flag=true;
break;
default : Console.Write("Choose Correct Option ");
break;
}
}
else if(i==2)
{
bill = bill + 2.00;
Console.Write(" * You selected Latte * * What would you like to add any items? * * 1. Honey * * 2. Caramel * * 3. Return to the main menu * ");
int m;
m=int.Parse(Console.ReadLine());
switch(m)
{
case 1 : Console.Write("You added Honey ");
break;
case 2 : Console.Write("You added Caramel ");
break;
case 3 : flag=true;
break;
default : Console.Write("Choose Correct Option ");
break;
}
}
else if(i==3)
{
bill = bill + 1.00;
Console.Write(" * You selected Pastry * * What would you like to add any items? * * 1. Donut * * 2. Cake * * 3. Pie * * 4. Return to the main menu * ");
int m;
m=int.Parse(Console.ReadLine());
switch(m)
{
case 1 : Console.Write("You added Donut ");
break;
case 2 : Console.Write("You added Cake ");
break;
case 3 : Console.Write("You added Pie ");
break;
case 4 : flag=true;
break;
default : Console.Write("Choose Correct Option ");
break;
}
}
else if(i==4)
{
flag=false;
break;
}
else
{
Console.Write("Invalid Choice..");
}
}
Console.Write("Total Bill Amount :$"+bill);
}
}
}
Explanation / Answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace check1
{
class Program
{
static void Main(string[] args)
{
double bill = 0.0;
int i;
bool flag = true;
Random rd = new Random();
int day = rd.Next(1,7);
int userCount=0;
while(flag)
{
var map = new Dictionary<string , string[]>();
Console.Write("Would you like to signup ");
char ch;
ch=char.Parse(Console.ReadLine());
if(ch == 'Y' || ch == 'y')
{
foreach (var pair in map)
{
userCount++;
}
if(userCount < 100)
{
Console.WriteLine("Please enter name ,address , email and phone number respectivly ");
string[] info = new string[3];
string name = Console.ReadLine();
info[0] = Console.ReadLine();
info[1] = Console.ReadLine();
info[2] = Console.ReadLine();
map.Add(name,info);
}
else
{
Console.WriteLine("MAximum users 100 reached ");
}
}
else
{
Console.WriteLine("Please enter name to search ");
string name = Console.ReadLine();
string[] mapValue = new string[3];
foreach (var pair in map)
{
string key = pair.Key;
mapValue = pair.Value;
Console.WriteLine(key + "/" + mapValue);
}
}
Console.Write("********************************** ");
Console.Write("* Welcome to Alonzos Coffee Shop! * * What would you like to order? * * 1. Coffe ($1.50) * * 2. Latte ($2.00) * * 3. Pastry ($1) * * 4. Exit * ");
Console.Write("********************************** ");
i = int.Parse(Console.ReadLine());
if (i==1)
{
bill = bill + 1.50;
Console.Write(" * You selected Coffee * * What would you like to add any items? * * 1. Sugar * * 2. Milk * * 3. Creamer * * 4. Return to the main menu * ");
int m;
m=int.Parse(Console.ReadLine());
switch(m)
{
case 1 : Console.Write("You added Sugar ");
break;
case 2 : Console.Write("You added Milk ");
break;
case 3 : Console.Write("You added Creamer ");
break;
case 4 : flag=true;
break;
default : Console.Write("Choose Correct Option ");
break;
}
}
else if(i==2)
{
bill = bill + 2.00;
Console.Write(" * You selected Latte * * What would you like to add any items? * * 1. Honey * * 2. Caramel * * 3. Return to the main menu * ");
int m;
m=int.Parse(Console.ReadLine());
switch(m)
{
case 1 : Console.Write("You added Honey ");
break;
case 2 : Console.Write("You added Caramel ");
break;
case 3 : flag=true;
break;
default : Console.Write("Choose Correct Option ");
break;
}
}
else if(i==3)
{
bill = bill + 1.00;
Console.Write(" * You selected Pastry * * What would you like to add any items? * * 1. Donut * * 2. Cake * * 3. Pie * * 4. Return to the main menu * ");
int m;
m=int.Parse(Console.ReadLine());
switch(m)
{
case 1 : Console.Write("You added Donut ");
break;
case 2 : Console.Write("You added Cake ");
break;
case 3 : Console.Write("You added Pie ");
break;
case 4 : flag=true;
break;
default : Console.Write("Choose Correct Option ");
break;
}
}
else if(i==4)
{
flag=false;
break;
}
else
{
Console.Write("Invalid Choice..");
}
}
if(day >=1 && day <=3)
bill -= 0.03*bill;
else if(day <=6)
bill -= 0.05*bill;
else
bill -= 0.10*bill;
Console.Write("Total Bill Amount :$"+bill);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.