+ 2

Help me what wrong

static void Main(string[] args) { console.WriteLine(" Code = "); int Code=int.Parse(console.ReadLine()); console.WriteLine ("quantity = "); int quantity=int.Parse(console.ReadLine ()); console.WriteLine ("{0,-20} | {1,12} | {2,12} | {3,12}", "PRODUCT NAME", "PRICE","QUANTITY","TOTAL(R$)"); switch (code); { case 1: console.WriteLine ("{0,-20} | {1,12:F2} | {2,12} | {3,12:F2}", "Cochorro Quente",4.0,quentity,quentity*4.0); break; case 2: console.WriteLine ("{0,-20} | {1,12:F2} | {2,12} | {3,12:F2}", "X-Salada",4.5,quentity,quentity*4.5); break ; case 3: console.WriteLine ("{0,-20} | {1,12:F2} | {2,12} | {3,12:F2}", "X-Bacon", 5.0, quentity, quentity*5.0); break; Console.WriteLine("Invalid code"); break; } Console.ReadLine(); }

27th Oct 2022, 6:15 AM
Chin Su
Chin Su - avatar
11 Answers
+ 2
You also have int Code vs switch(code). and why do you have a other readline at the end?
27th Oct 2022, 9:26 AM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Write a program to input the product code (code) and quantity (amount) to buy. Calculate and print out the payment information as in the example below: For example: Enter code = 3, quantity = 2. Information will be printed on the screen as follows: PRODUCT NAME PRICE | QUANTIY 3 | TOTAL (R$) X-Bacon 5.00 | 15.00 Instructions: The PRODUCT NAME column is 20 characters wide and left aligned; PRICE, QUANTITY, TOTAL columns are 12 characters wide and right-aligned. There is a space before and after each 'lā€² character ("PRODUCT NAME | PRICE | AMOUNT | TOTAL")
27th Oct 2022, 7:36 AM
Chin Su
Chin Su - avatar
+ 2
CODE PRODUCT NAME PRICE 1 Cochorro Quente R$ 4.00 2 X-Salada R$ 4.50 3 X-Bacon R$ 5.00 4 Torrada simples R$ 2.00 5 Refrigerante R$ 1.00
27th Oct 2022, 7:38 AM
Chin Su
Chin Su - avatar
+ 2
Happy I could help.
27th Oct 2022, 9:43 AM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Show me your code and I will try to help. I'm sure you can do it.
27th Oct 2022, 3:55 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Check your spelling. At the beginning you have Int quantity Case 1, 2, 3 have quentity, quentity
27th Oct 2022, 7:26 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Oh thanks. I found that
27th Oct 2022, 9:39 AM
Chin Su
Chin Su - avatar
0
it still doesn't work even though it's fixed quentity => quantity
27th Oct 2022, 8:12 AM
Chin Su
Chin Su - avatar
0
So how about this
27th Oct 2022, 9:45 AM
Chin Su
Chin Su - avatar
0
ABC Company decides to increase salary for employees according to the following table: Salary 0-400.00 Increase Percentage 15% 400.01-800.00 twelfth% 800.01-1200.00 ten% 1200.01 - 2000.00 7% >2000 4% Write a program to input an employee's current salary. Calculate the new salary for that employee. Example: Employee's current salary is 400, the new salary is 460.
27th Oct 2022, 9:46 AM
Chin Su
Chin Su - avatar
- 1
hlw
29th Oct 2022, 4:20 AM
Jabad Ikbal
Jabad Ikbal - avatar