DCIT 318-Assignment 1-10882603
DCIT 318-Assignment 1-10882603
ASSIGNMENT 1
ID: 10882603
Write a program that prompts the user to enter a numerical grade between 0 and 100. Based
on the grade entered, display the corresponding letter grade using the following scale:
· 90 and above: A
· 80-89: B
· 70-79: C
· 60-69: D
· Below 60: F
Solution
using System;
char letterGrade;
Q2: Ticket Price Calculator
A movie theater sells tickets for GHC10. However, if a customer is a senior citizen (age 65
and above) or a child (age 12 and below), they receive a discounted price of GHC7. Write a
program that prompts the user to enter their age and calculates the ticket price based on the
age entered. Display the ticket price accordingly.
Solution
using System;
class Ticket_Price_Calculator
{
static void Main()
{
int t_price = 10;
int d_price = 7;
Write a program that prompts the user to enter three sides of a triangle. Based on the lengths
of the sides entered, determine and display the type of the triangle. The possible types are:
Solution
using System;
class Triangle_Type_Identifier
{
static void Main()
{
Console.WriteLine("Enter the length of the first side:");
double side1 = Convert.ToDouble(Console.ReadLine());
Create a program that displays a menu with three options: 1) Play, 2) Pause, and 3) Stop.
Prompt the user to enter a choice. Based on the choice entered, display a corresponding
message. Use a switch statement to handle the menu selection.
Solution
using System;
class Menu_Selector
{
static void Main()
{
Console.WriteLine("Menu:");
Console.WriteLine("1) Play");
Console.WriteLine("2) Pause");
Console.WriteLine("3) Stop");
switch (option)
{
case 1:
Console.WriteLine("Playing...");
break;
case 2:
Console.WriteLine("Paused.");
break;
case 3:
Console.WriteLine("Stopped.");
break;
default:
Console.WriteLine("Invalid option.");
break;
}
}
}