1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Rep Power

    C# college assignment help needed

    So this is the college assignment. The program doesn't seem to recognise the euro sign for some strange reason? What is with that?

    A painting company has determined that for every 115 square feet of wall space, one gallon of paint is required and eight hours of labour is required. The company charges €18.00 per hour of labour plus VAT at 13%). Write a program that allows the user to enter:
    • The customer name
    • The number of rooms that are to be painted,
    • The price, before tax of paint per gallon,
    • The square feet of wall space for each room.
    VAT on paint is charged at 23%. VAT on labour is charged at 13%. Assume all rooms are of the same size. The company does some work in the UK, so also requires the total cost to be given in sterling, use exchange rate of 1 euro = 0.81 pounds.

    The program will return the following data in the format shown

    Job Quote
    Customer Name : xxxxxxxxxxxxxxxxxxxxxx
    Date: 20/09/2013

    Total Number of gallons : xx.xx
    Total Hours of labour : xx.xx
    Cost of Paint : €xx.xx
    Paint VAT : €xx.xx
    Total cost of Paint : €xx.xx
    Labour Cost : €xx.xx
    Labour VAT : €xx.xx
    Total Labour Cost : €xx.xx
    Total Cost of job : €xx.xx
    Sterling Equivalent : £xx.xx

    This is what i got so far

    //Variables: Misc
    string Username;
    int Rooms;
    float Paint;
    double Labour;
    double Wallspace;
    double Gallons;
    //Paint Variables
    double Paintcost;
    double Paintvat;
    double Painttotal;
    // Labour Variables
    double Labourcost;
    double Labourvat;
    double Labourtotal;
    //Final Variables
    double Totalcost;
    double Sterlingcost;

    //Start up commands

    Console.WriteLine("Please enter your name: ");
    Username = Console.ReadLine();

    Console.WriteLine("Please enter the number of rooms that need painting: ");
    Rooms = Convert.ToInt32(Console.ReadLine());

    Console.WriteLine("Please enter the size of the room in square meters: ");
    Wallspace = Convert.ToInt32(Console.ReadLine());

    Console.WriteLine("Enter price of paint per gallon");
    Paint = Convert.ToInt32(Console.ReadLine());

    // Processes:Misc
    Gallons = Wallspace / Rooms;
    Labour = Gallons * 8;

    //Labour Processes
    Labourcost = Labour * 18;
    Labourvat = Labourcost * .13;
    Labourtotal = Labourcost + Labourvat;

    //Paint Processes
    Paintcost = Paint * Gallons;
    Paintvat = Paintcost * .23;
    Painttotal = Paintcost + Paintvat;

    //Final Processes
    Totalcost = Painttotal + Labourtotal;
    Sterlingcost = Totalcost * .81;

    //Invoice Info

    Console.WriteLine("Job Quote Painter");
    Console.WriteLine("Customers : " + Username);
    Console.WriteLine("Date : ");
    Console.WriteLine("Total Number of Gallons: " + Gallons);
    Console.WriteLine("Total Hours of Labour: " + Labour);
    Console.WriteLine("-----------------------------"); Console.WriteLine("Cost of paint: " + Paintcost);
    Console.WriteLine("Paint Vat: " + Paintvat);
    Console.WriteLine("Total Cost of Paint: " + Totalcost);
    Console.WriteLine("Labout Cost: " + Labourcost);
    Console.WriteLine("Labour Vat: " + Labourvat);
    Console.WriteLine("Total Labour Cost: " + Labourtotal);
    Console.WriteLine("Total Cost of Job: " + Totalcost);
    Console.WriteLine("Sterling Equivalent:£ " + Sterlingcost);
  2. #2
  3. Contributing User

    Join Date
    Aug 2003
    Rep Power
    Missing the lecture is one thing, but it would have been your responsibility to obtain lecture notes or course text after the event. What do you have so far? Surely that was not the first lecture on the subject? If you have no notes or course materials, then the best (and most academically honest) way to catch up is perhaps to go through on of the many C# tutorials available on the Web.

    What do you mean "handle the int" there is a bit more to it than that, and we are not here to do your homework for you. Also the question rather suggests using the "decimal" data type rather than "int". You should use "decimal" in preference to "float" or "double" for financial applications.

    The VAT and the conversion is not about programming, but arithmetic. Is it your programming or your numeracy that is lacking? The requirement is a simple get input -> perform calculations -> write output candy-machine type program.

    The lecture slides here for example cover all you should need for the input and output operations.

    Here's the (rather simple) arithmetic (though you should check for accuracy).

    gallons = rooms * sqft_per_room / 115 ;
    hours = 8 * gallons ;
    net_paint_cost_euro = paint_cost_per_gallon * gallons ;
    paint_vat = 0.13 * net_paint_cost_euro ;
    total_paint_cost_euro = net_paint_cost_euro + paint_vat ;
    net_labour_cost_euro = 18 * hours ;
    labour_vat = 0.23 * net_labour_cost ;
    total_labour_cost - net_labour_cost + labour_vat ;
    total_cost_euro = total_paint_cost + total_labour_cost ;
    total_cost_euro = 0.81 * total_cost_euro ;
    Note that the above code is not valid C# syntax if the data type used is "decimal" - treat it as pseudo-code only. For details of the decimal data type see here for example, and of course Microsoft's documentation.

IMN logo majestic logo threadwatch logo seochat tools logo