Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Users may order one or more dosas, where each dosa may be either: small, medium or large. Plain Dosa cost Rs.15/-, Onion Dosa cost RS.25/-, Masala Dosa cost Rs.35/- and Ghee Rava Dosa Rs.50/- All dosas come with coconut chutney by default, at no extra cost. Users may choose up to a maximum of three additional chutneys/gravy (bringing the total chutneys to four- 1 for free of cost and remaining 3 adds extra RS.30/) from the following list, where each chutney/gravy adds an additional RS.10/- to the price of the dosa:  Onion chutney  Tomato chutney  Ginger chutney  Garlic chutney  Peanut chutney  Coriander chutney A dosa order consists of an order for one or more dosas, where each dosa may optionally include a list of up to three additional chutneys. Each dosa order must be marked as either to be collected or to be delivered.  If the dosa is to be collected then the order requires only name to be valid.  If the dosa is to be delivered then a name, phone number and address are required to be valid. In addition, if the order total is less than Rs.100/- then an Rs.25/- delivery charge is added to the total. The application must be error tolerant and capable of accepting keyboard input to store a number of dosa orders in memory (they do not have to be persisted to file), as well as displaying an order summary which include details of all orders, including:  The details of each dosa in the order,  The total cost of the order, and  The name, phone number and (if required) address of the person who made the order.


What I have tried:

i tried using the concept of if else
Posted
Updated 20-Feb-21 10:12am
Comments
Patrice T 20-Feb-21 3:56am    
Show what you have done and explain the problem you have with it.

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Quote:
i tried using the concept of if else
That's a start.
Now you should try using also structs, arrays, and the switch statement.
 
Share this answer
 
Comments
Richard MacCutchan 20-Feb-21 8:05am    
But he only tried the concept of if else. :)
Some general code examples for you to see and examine.
https://en.wikipedia.org/wiki/Conditional_%28computer_programming%29
http://www.awitness.org/delphi_pascal_tutorial/c++_delphi/c++_if_then_else.html
https://www.siteforinfotech.com/2014/07/program-in-c-to-sort-list-ascending-order.html
https://www.thoughtco.com/the-if-then-and-if-then-else-statements-2033884


I would suggest to approach this by first writing a list on paper of what I want the user to see.

dosas        /   cost (Rs or RS)
             /   Plain   /   Onion   /   small   /   medium   / large
Plain Dosa   /   15      /   25 


etcetera

Then write out manually the if then else conditions.

Program this a little at a time.

Then use a simple program that does not do much other than say "hello world".

Then add to the hello world program a simple if then action.

Then add to the hello world program an else into it.

Then go back and add in more of the if's and the then's and the else's.

Very important for beginners:
Test compiling and running the code often. Do not write a lot of code between tests, just enough for it to work a little more.

Get this to work for all of the conditions before you start on the "If the dosa is to be collected then the order requires only name to be valid." part.

Then you might be ready to ask about the next part.

It can all be done with if then else. All of it. You do not need to even look at structs or arrays or switches until you have the if then else working. Then if you want to get into structs or arrays or switches you can, but they are not necessary for learning basic conditional logic. You can write the entire program without them.

Ask more later somewhere after you get the if then else working.

C is not difficult.

Take your time and you can do this.
 
Share this answer
 
v2

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