You are going to create and submit 2 projects that accumulate ticket orders for
ID: 3542447 • Letter: Y
Question
You are going to create and submit 2 projects that accumulate ticket orders for a concert. Both should
work in a similar manner, but 1 will be a console program, and the other will be a Windows application.
The user should be able to input an unlimited number of ticket orders. Each input will be the number of
tickets for that order. Accumulate the total number of tickets. At any time, the user can view the total
number of tickets ordered. In the console application, use a negative value to end the program.
Explanation / Answer
Hi ,
Here is the code for the console app...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tcount1
{
class Program
{
static void Main(string[] args)
{
string s = "";
Console.WriteLine(" Enter Count of Tickets Ordered");
s = Console.ReadLine();
int num=0;
int total = 0;
while (Int32.TryParse(s, out num))
{
if (num <0)
{
break;
}
total = total + num;
s = Console.ReadLine();
}
Console.WriteLine(" Total tickets ordered:" + total);
Console.Read();
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.