Question

BCS 215 (Unix Operating Systems) Create a bash shell script that displays a coffee vending machine...

BCS 215 (Unix Operating Systems)

Create a bash shell script that displays a coffee vending machine menu and asks the user to make a choice -

1. Print "Please enter your choice: decaf|regular|latte|cappuccino"

2. Depending on the user input, print out the related price -

decaf: 2 dollars

regular: 2 dollars

latte: 3 dollars

cappuccino: 3 dollars

For anything else, please display "Please make a valid choice."


3. Upon a successful execution of the script, display "Thank you for using the coffee vending machine!" (Hint: use 'trap')

----------------------------
For example:

If the user enters "regular", the program prints -

2 dollars

Thank you for using the coffee vending machine!

0 0
Add a comment Improve this question Transcribed image text
Answer #1


#include <iostream>

using namespace std;
void lima(string &name,int &age){
   cout<<"Enter name: ";
   cin>>name;
   int flag=0;
   for(int i=0;i<3;i++){
       cout<<"Enter age between 0-100: ";
       cin>>age;
       if(age>=0 && age<=100){
           flag=1;
           break;
       }
       cout<<"Error: Invalid age"<<endl;
   }
   if(!flag)
       age=0;
}
int main()
{
string name;
int age;
lima(name,age);
cout<<"Name : "<<name<<endl;
cout<<"Age : "<<age<<endl;
return 0;
}

#include <iostream> 10 using namespace std; void lima (string &name,int &age){ 11 12 cout<<Enter name: 13 cin>>name; 14 int

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
BCS 215 (Unix Operating Systems) Create a bash shell script that displays a coffee vending machine...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Putty 1. Create Bash shell script that would let a user make a copy of...

    In Putty 1. Create Bash shell script that would let a user make a copy of all the files in a directory. (3 points) 2. Create two Bash shell scripts that will perform some work (of your choice). (2*3 = 6 points) 3. Create a Bash shell script that would serve as a menu for the three scripts you have created. (1 point)

  • USING Unix/Linux shell !!!: 1) Write a script (project2.sh) that will take information from a file,...

    USING Unix/Linux shell !!!: 1) Write a script (project2.sh) that will take information from a file, and print (user’s choice of printers) identical form letters to each recipient. Either E197, E-199, E-194 printers or to project2.output. Prompt the user for their choice. 2) The script and output file are due: per Moodle timeline. Please upload your fully functioning script (project2.sh) your data file (project2.input) and your output file (project2.output) into Moodle. 3) Requirements of the script. a. You can use...

  • Hello all, I have a c++/unix (bash) question. I am struggling on starting this assignment. If...

    Hello all, I have a c++/unix (bash) question. I am struggling on starting this assignment. If you could start the assignment and tell me how to do the rest it would be greatly appreciated! (Quick thumbs up answer response if thorough and correct) Maintain automobile records in a database Write a shell script to create, view and modify a simple database that contains automobile records. The shell script has to be done in Bourne shell syntax (bash as a matter...

  • Hello, please help with the following, you're tasked with writing a shell script named “rpsm.sh”....

    Hello, please help with the following, you're tasked with writing a shell script named “rpsm.sh”. The script reports and prints (to stdout) selected storage management information. Think of it as “RePort Storage Management”. The easy way to describe what the script needs to do is to look at what it should display in the case where you provide incorrect parameters, or in the case where you provide “-h” for help: Usage: ./rpsm.sh <options>< directory> Reports selected information about specified directory...

  • Your assignment is to create a restaurant ordering system where the cashier can create the menu...

    Your assignment is to create a restaurant ordering system where the cashier can create the menu and then take in the order and display the order back to the customer Sample Execution – Level 1 Welcome to your Menu Creation system. How many items would you like to have on your menu? 2 Create your menu! Enter item #1: Coffee Enter item #2: Tea This is the menu: Coffee Tea What would you like to order? Cake That isn’t on...

  • SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the...

    SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the company's new line of single-serve coffee pods or to await results from the product's launch in the United States. Key strategic decisions include choosing the target market to focus on and determining the value proposition to emphasize. Important questions are also raised in regard to how the new product should be branded, the flavors to offer, whether Kraft should use traditional distribution channels or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT