assignment

Babuuh · August 01, 2020 · C#
using System;
using System.IO;

namespace MyApplicat{
    class Program {
        
        
        public static void Main(string[] args){
            
            //Declaring and storing the variables
            string Name = "John Smith";
            string Address = "101 N. Main Street";
            string city = "Anytown";
            string state = "TX";
            int zip = 1111;
            string Number_of_units = "19";
            const double price_per_unit = 100.50;
            const int twenty_unit_hour_discount = 150;
            double tuition,afterDiscount,MonthlyPayment;
            int units_taken;
            
            //converting units taken to int and incrementing by 1
            units_taken = Convert.ToInt32(Number_of_units);
            units_taken += 1;
            
            //calculating the tuition without discount
            tuition = units_taken * price_per_unit;
            
            //calculating the tution after twenty_unit_hour_discount
            afterDiscount = tuition - twenty_unit_hour_discount;
            
            //calculating the monthly payment after discount
            MonthlyPayment = afterDiscount / 12;
            
          
            //outputting the stored variables and the calculated values
            Console.WriteLine("Name: " + Name);
            Console.WriteLine("Address: " + Address);
            Console.WriteLine("City: " + city);
            Console.WriteLine("State: " + state);
            Console.WriteLine("Zip Code: " + zip);
            
            //outputting and formating to currency
            Console.WriteLine("The number of units taken is: " + units_taken);
            Console.WriteLine("The tuition before discount is: {0:C2} ", tuition);
            Console.WriteLine("The tuition after twenty-unit discount is: {0:C2} ", afterDiscount);
            Console.WriteLine("Your monthly payment is: {0:C2}  ", MonthlyPayment);
        }
    }
}

Comments

Please sign up or log in to contribute to the discussion.