Level 3 - Condition controlled repetitions 0 of 9 activities solved
  1. Capital city Not yet solved
  2. Car value Not yet solved
  3. Adder Not yet solved
  4. Compound interest Not yet solved
  5. Valid month Not yet solved
  6. Cashpoint Not yet solved
  7. Square root Not yet solved
  8. PIN Not yet solved
  9. Measurements Not yet solved
Next series Assessment point - Levels 1-3
Level 3 - Condition controlled repetitions

Car value

Sign in to hand in your solution and get feedback.

// Car value program using System; class Submission { // ------------------------- // Subprograms // ------------------------- static void show_value(int value, int resale_value) { int year = 0; double depreciation = 0.25; while ((value >= resale_value) && (resale_value > 0)) { Console.WriteLine($"In year {year}, the car is worth £{value}"); value = (int)(value - (value * depreciation)); year = year + 1; } Console.WriteLine($"Part exchange before end of year {year}"); } // ------------------------- // Main program // ------------------------- public static void Main(string[] args) { Console.WriteLine("Enter the value of the car purchased: £"); int value = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the minimum part exchange value: £"); int resale_value = Convert.ToInt32(Console.ReadLine()); show_value(value, resale_value); } }