Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program Header
- //Program Name: Basic User Interface
- //Programmer:
- //CIS 247, Week 1 Lab
- //Program Description: Gets user input and displays name, age, and gas mileage
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CIS247_WK1_Lab
- {
- class Program
- {
- static void Main(string[] args)
- {
- ApplicationUtilitiesinternal.DisplayApplicationInformation();
- ApplicationUtilitiesinternal.DisplayDivider("Press any key to start");
- Console.ReadLine();
- ApplicationUtilitiesinternal.DisplayDivider("Get Name");
- Console.WriteLine("What is your name?");
- string name = InputUtilities.GetInput("name");
- //Prompts user for their age
- int age;
- ApplicationUtilitiesinternal.DisplayDivider("Get Age");
- Console.WriteLine("How old are you?");
- string getAge = InputUtilities.GetInput("Age");
- age = Int32.Parse(getAge);
- //Prompts user to enter their car's mile per gallon
- double galMileage;
- ApplicationUtilitiesinternal.DisplayDivider("Get MPG");
- Console.WriteLine("What is your car's miles per gallon?");
- string getGasMileage = InputUtilities.GetInput("gas mileage");
- galMileage = double.Parse(getGasMileage);
- //Name, Age, and galMileage outputs to the screen
- Console.WriteLine("Hello, " + name);
- Console.WriteLine("Your age is " + age);
- Console.WriteLine("Your car's miles per gallon is " + galMileage);
- Console.ReadLine();
- ApplicationUtilitiesinternal.TerminateApplication();
- }
- class ApplicationUtilitiesinternal
- {
- public static void DisplayApplicationInformation()
- {
- Console.WriteLine("Welcome to the Basic User Interface Program! [PRESS ENTER]");
- Console.ReadLine();
- Console.WriteLine("CIS247, Week 1 Lab");
- Console.WriteLine("Name: Junkie [PRESS ENTER]");
- Console.ReadLine();
- Console.WriteLine("This program accepts user input as string, then makes the appropriate data conversion");
- }
- internal static void DisplayDivider(string outputTitle)
- {
- Console.WriteLine("****************" + outputTitle + "****************");
- }
- internal static void TerminateApplication()
- {
- Console.WriteLine("Thank you for using the Basic User Interface Program. Press any key to exit.");
- Console.ReadLine();
- }
- }
- }
- class InputUtilities
- {
- internal static string GetInput(string inputType)
- {
- Console.WriteLine("Enter your " + inputType);
- string strInput = Console.ReadLine();
- return strInput;
- }
- }
- }
Add Comment
Please, Sign In to add comment