Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
write a c# program to inputs buy any fruit item and calculate the total bill according to given instructions: press [s] to strawberry @ Rs. 120 per kg & 1s. 100 if you buy more than 1 kg. press [a] to buy apple @ Rs.200 per kg & Rs. 150 if you buy more than 1 kg press [g] to buy guava @Rs 100 per kg & Rs. 80 if you buy more than 1 kg.

What I have tried:

im trying but can't make logic
Posted
Updated 8-Dec-22 21:38pm
Comments
Richard MacCutchan 8-Dec-22 12:16pm    
The first thing you need to do is to create a simple menu that displays the fruits, and waits for the user to make a selection. So work on getting that done first. Don't forget to warn them if they type a selection that does not exist.
PIEBALDconsult 8-Dec-22 12:47pm    
Design from the top down, implement from the bottom up.
[no name] 8-Dec-22 20:53pm    
You need a fourth option: [q] Quit (which perhaps shows the total). You keep looping, handling the other options, until quit is requested.

 
Share this answer
 
Comments
RickZeeland 9-Dec-22 4:18am    
Sounds to me like you are the confused person ... :)
where did you get the idea that this is a winforms question?
Richard MacCutchan 9-Dec-22 4:52am    
Come on Bill, it's an obvious Console app.
BillWoodruff 9-Dec-22 5:11am    
I have another opinion, Sir :) but, i have changed my vote on Rick's solution to #4.

"inappropriate" was an inappropriate term for conveying the idea that learning a Console app, which is interactive, is an investment of time and energy which will not generalize in the way that a simple WinForm app will.
Richard MacCutchan 9-Dec-22 5:25am    
The OP is obviously a student who has very little experience or teaching. The chances of them understanding how to write a WinForms app, when they cannot grasp the basic logic of such a simple question, is not high, IMHO.
Richard MacCutchan 9-Dec-22 9:05am    
Well I would say that given the number of homework questions we see here every day, far from being blind, we get a fair idea of what is required, even when the questions are poorly described.

As to my standards, I have never claimed that you do not meet them, and I have never stated what my standards may be. What I did challenge was your comment to Rick that his answer was inappropriate.
You need to sort learning C# and Windows Forms: get a good book, and start experimenting.

Free C# books: [^], [^]

Make an outline of the flow of control of the program, and what Controls you will need. Experiment with those Controls,

No one here will write your code for you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900