Question

VISUAL STUDIO (NO JAVA CODING) Create a C# Console Application project to compute the tuition fee...

VISUAL STUDIO

(NO JAVA CODING)

Create a C# Console Application project to compute the tuition fee a student should pay.
In this part of the assignment, you are required to create a C# Console Application project.
Project name should be A2<FirstName><LastName>P1. For example a student with first name John and Last name Smith would name the project A2JohnSmithP1.
Step 1: Ask if a student is a Canadian Citizen or an International Student. Also ask for their age. You must use an If-Else-Elseif statement to get full marks.
Logic:
 If the student's age is 18 or below, they must pay $300 + 13% HST
 If the student is aged 19 to 49, they must pay $500 + 13% HST
 If the student is aged 50 or above, they must pay $400 + 13% HST
 If the student is an international student, they must pay an extra $100 before tax is applied.
Step 2: Ask for the month the student registered. You must use a switch statement to get full marks.
Logic:
 If they registered in any of the Fall months (Sept., Oct., Nov., or Dec.), add $250 + 13% HST
 If they registered in any of the Winter months (Jan., Feb., Mar. or Apr.), add $220 + 13% HST
 If they registered in any of the Summer months (May, Jun., Jul. or Aug.), add $150 + 13% HST
Calculate the total tuition a student owes by adding up the value obtained in Step 1 and Step 2.
Show the total tuition fee on the C# Console application. The display will look something contain:
The Student's age (as entered)
International Student (or not) (as entered)
Registration Semester (as entered)
Base Tuition (as calculated by the application)
International Student fee (if applicable, as calculated by the application)
Registration Fee for semester (as calculated by the application)
HST (as calculated by the application)
Final Total (as calculated by the application)

Homework Answers

Answer #1

Create a new C# console application with the name  A2<FirstName><LastName>P1as said above, I used A2JohnSmithP1.

Add the below code in Program.cs

Program:

using System;

namespace A2JohnSmithP1
{
class Program
{
static void Main(string[] args)
{
string citizen;
bool isCanadian;
int age;
double total = 0.0, baseTuitionFee = 0.0, internationalFee = 0.0, HST = 0.0, registrationFee = 0.0;

//prompt and read if Student is Canadian Citizen
Console.Write("\nAre you a Canadian Citizen(y/n)? ");
citizen = Console.ReadLine();
//if y is entered set isCanadian to true
if (citizen.ToLower() == "y")
{
isCanadian = true;
}
else
{
//else set isCanadian to false
isCanadian = false;
}

//prompt and read the age
Console.Write("\nEnter your age: ");
age = Convert.ToInt32(Console.ReadLine()); ;

//if age is less than or equal to 18
if (age <= 18)
{
//set base fee
baseTuitionFee = 300;
//calculate HST
HST = HST + ((baseTuitionFee * 13) / 100);
}
//if age is greater than or equal to 19 and less then or equal to 49
else if(age>=19 && age<=49)
{
//set base fee
baseTuitionFee = 500;
//calculate HST
HST = HST + ((baseTuitionFee * 13) / 100);
}
//if age is greater than or equal to 50
else if (age >=50)
{
//set base fee
baseTuitionFee = 400;
//calculate HST
HST = HST + ((baseTuitionFee * 13) / 100);
}
//if student is international student set intenationfee
if (isCanadian == false)
internationalFee = 100;

//prompt and read the month, assuming that student entered full month name
String month;
Console.Write("\nEnter the month the student registered: ");
month=Console.ReadLine();

//run a switch case using month
switch (month.ToLower())
{
//if month is Sept., Oct., Nov., or Dec.
case "september":
case "october":
case "november":
case "december":
//set registration fee
registrationFee = 250;
//calculate HST
HST = HST + ((registrationFee * 13) / 100);
break;

//if month is Jan., Feb., Mar. or Apr.
case "january":
case "february":
case "march":
case "april":
//set registration fee
registrationFee = 220;
//calculate HST
HST = HST + ((registrationFee * 13) / 100);
break;

//if month is May, Jun., Jul. or Aug.
case "may":
case "june":
case "july":
case "august":
//set registration fee
registrationFee = 150;
//calculate HST
HST = HST + ((registrationFee * 13) / 100);
break;
default:
//if invalid month is entered show error msg and exit the program
Console.WriteLine("\nYou entered an invalid month.. the application is terminated.");
break;
}

//calculate total fee
total = baseTuitionFee + registrationFee + HST + internationalFee;
if (registrationFee != 0)
{
//print the fee details
Console.Write("\nThe Student's age: " + age);
if(isCanadian)
Console.Write("\nInternation Student: NO" );
else
Console.Write("\nInternation Student: YES");
Console.Write("\nRegistration Semester: "+month);
Console.Write("\nBase Tuition: $"+baseTuitionFee.ToString("0.00"));
Console.Write("\nInternation Student fee: $" + internationalFee.ToString("0.00"));
Console.Write("\nRegistration Fee for Semester: $" + registrationFee.ToString("0.00"));
Console.Write("\nHST: $" + HST.ToString("0.00"));
Console.Write("\nFinal Total: $" + total.ToString("0.00"));
}
Console.ReadKey();
}
}
}

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Project 2 statement Please write this in JAVA. Please read this entire statement carefully before you...
Project 2 statement Please write this in JAVA. Please read this entire statement carefully before you start doing anything… This project involves implementing a simple university personnel management program. The program contains two different kinds of objects: students and faculty. For each object, the program stores relevant information such as university ID, name, etc. Different information is stored depending on the type of the object. For example, a student has a GPA, while a faculty has a title and department...
Create an uml Sequence Diagrams for the following scenario A student at Grambling must register for...
Create an uml Sequence Diagrams for the following scenario A student at Grambling must register for class and pay for the class each term. Show all the steps done in the process starting with getting your pin to paying your fees.   Go to GSU’S website: www.gram.edu 2. Click on current student and then Banner Web 3. Click on Enter Secure Area 4. To Login: a. Enter User ID: Student ID No. e.g., GXXXXXXXX b. Enter PIN#: Date of Birth (mmddyy)...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...