static void Main(string[] args) { Console.WriteLine("Hello!"); Console.WriteLine("What type of room do you want?(family room, double room, double room with mountains view, room for a single person)?"); rooms = Console.ReadLine(); switch (rooms) { case "family room": Console.WriteLine("The price for family room is " + familyRoom + "RON/night, it is the room number 1 and it's located on ground floor"); Console.WriteLine("How many nights do you want to stay?"); days = Console.ReadLine(); daysParse = Convert.ToInt32(days); Console.WriteLine("The total price for " + days + "day/days is: " + familyRoom * daysParse + "RON"); break; case "double room": Console.WriteLine("The price for the double room is " + doubleRoom + "RON/night, it is the room number 2 and it's located on 1st floor"); Console.WriteLine("How many nights do you want to stay?"); days = Console.ReadLine(); daysParse = Convert.ToInt32(days); Console.WriteLine("The total price for " + days + "day/days is: " + doubleRoom * daysParse + "RON"); break; case "double room with mountains view": Console.WriteLine("The price for the double room with mountains view is " + doubleRoomView + "RON, it is the room number 3 and 4 and it's located on 1st floor"); Console.WriteLine("How many nights do you want to stay?"); days = Console.ReadLine(); daysParse = Convert.ToInt32(days); Console.WriteLine("The total price for " + days + "day/days is: " + doubleRoomView * daysParse + "RON"); break; case "room for a single person": SingleRoom room = new SingleRoom(); Console.WriteLine("The price for the room for a single person is " + singlePersonRoom + "RON, it is the room number 5 and 6 and it's located on 1st floor"); Console.WriteLine("If you book more than 3 nights, you have a 20% discount for each additional night!"); Console.WriteLine("How many nights do you want to stay?"); days = Console.ReadLine(); daysParse = Convert.ToInt32(days); if (daysParse <= 3 && daysParse != 0) { Console.WriteLine("The total price for " + days + "day/days is: " + singlePersonRoom * daysParse + "RON"); } else { reduction = room.Reduction(singlePersonRoom); Console.WriteLine("Price after reduction:" + reduction + "RON for the nights over 3."); sum = singlePersonRoom * 3 + reduction * (daysParse - 3); Console.WriteLine("The total price for " + days + "day/days is: " + sum + "RON"); } break; default: throw new Exception("invalid"); } }
static void Main(string[] args) { Console.WriteLine("**********************************************Real Estate Calculator**********************************************\n"); //Console.WriteLine(""); Console.Write("The price in euro for the real estate is: "); priceRealEstate = Convert.ToDecimal(Console.ReadLine()); Console.Write("The zone is (central, periphery): "); answer = (Console.ReadLine()).ToLower(); switch (answer) { case "central": zone = answer; break; case "periphery": zone = answer; break; default: Console.WriteLine("Invalid value!"); break; } IDisplayMonitor dsp = new DisplayMonitor(); Console.WriteLine("Choose for what type of real estate you need to calculate the commission (single room, apartment, house, parcel): "); realEstate = Console.ReadLine().ToLower(); switch (realEstate) { case "single room": Console.Write("The address is: "); address = Console.ReadLine(); FeeCalculator singleRoomCalculator = new SingleRoomFeeCalculator(); IRealEstate room = new SingleRoom(priceRealEstate, zone, address); dsp.Message(room, singleRoomCalculator); break; case "apartment": Console.Write("The address is: "); address = Console.ReadLine(); var apartmentCalculator = new ApartmentFeeCalculator(); IRealEstate apartment = new Apartment(priceRealEstate, zone, address); dsp.Message(apartment, apartmentCalculator); break; case "house": Console.Write("The address is: "); address = Console.ReadLine(); IRealEstate house = new House(priceRealEstate, zone, address); var houseCalculator = new HouseFeeCalculator(); dsp.Message(house, houseCalculator); break; case "parcel": Console.Write("The cadastral number is: "); address = Console.ReadLine(); var parcelCalculator = new ParcelFeeCalculator(); IRealEstate parcel = new Parcel(priceRealEstate, zone, address); dsp.Message(parcel, parcelCalculator); TestParcel(); break; default: Console.WriteLine("You must to choose one of the single room, apartment, hose or parcel!"); break; } }
static void Main(string[] args) { Console.WriteLine("Choose 1 if you want to calculate the commission for the real estate give by you, or 2 for calculate commission for the real estate from data base!"); val = Console.ReadLine(); switch (val) { case "1": Console.Write("Choose for what type of real estate you need to calculate the commission (single room, apartment, house): "); realEstate = Console.ReadLine(); switch (realEstate) { case "single room": SingleRoom room = new SingleRoom(); Console.Write("The price for a single room is: "); priceRealEstate = Console.ReadLine(); priceRealEstateDouble = Convert.ToDouble(priceRealEstate); Console.Write("Commission for single room with price " + priceRealEstateDouble + " is: "); Console.WriteLine(room.CalculationCommissionn(priceRealEstateDouble)); break; case "apartment": Apartment apartment = new Apartment(); Console.Write("The price for an apartment is: "); priceRealEstate = Console.ReadLine(); priceRealEstateDouble = Convert.ToDouble(priceRealEstate); Console.Write("Commission for apratment with price " + priceRealEstateDouble + " is: "); Console.WriteLine(apartment.CalculationCommissionn(priceRealEstateDouble)); break; case "house": House house = new House(); Console.Write("The price for a house is: "); priceRealEstate = Console.ReadLine(); priceRealEstateDouble = Convert.ToDouble(priceRealEstate); Console.Write("Commission for house with price " + priceRealEstateDouble + " is: "); Console.WriteLine(house.CalculationCommissionn(priceRealEstateDouble)); break; default: Console.Write("You must to choose one of the single room, apartment, hose!"); break; } break; case "2": Console.Write("Choose for what type of real estate you need to calculate the commission (single room, apartment, house): "); choose = Console.ReadLine(); switch (choose) { case "single room": SingleRoom room = new SingleRoom(); for (int i = 0; i < singleRoomPrice.Length; i++) { Console.Write("Commission for single room with price " + singleRoomPrice[i] + " is: "); Console.WriteLine(room.CalculationCommissionn(singleRoomPrice[i])); } break; case "apartment": Apartment apartment = new Apartment(); for (int i = 0; i < apartmentPrice.Length; i++) { Console.Write("Commission for apratment with price " + apartmentPrice[i] + " is: "); Console.WriteLine(apartment.CalculationCommissionn(apartmentPrice[i])); } break; case "house": House house = new House(); for (int i = 0; i < housePrice.Length; i++) { Console.Write("Commission for house with price " + housePrice[i] + " is: "); Console.WriteLine(house.CalculationCommissionn(housePrice[i])); } break; default: Console.Write("You must to choose one of the single room, apartment, hose!"); break; } break; default: Console.Write("You can choose 1 or 2!"); break; } }