Question-1: We want to write a program for a drink machine working as follows. The customer enters a drink code and the machine displays his choice according to the following look-up table: Drink Juice Coffee Milk Write the corresponding Matlab code using: Nested if-else statements Switch statements Code 1 2 3
Added by Lisa C.
Close
Step 1
First, we need to prompt the customer to enter a code. We can use the `input` function for this. Show more…
Show all steps
Your feedback will help us improve your experience
James Kiss and 92 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Rewrite the following switch statement as a nested if statement using a series of else...if statements:
Using Switch statement, develop application that displays the following menu for the food items available to take order from the customer: B= Burger F= French Fries P= Pizza S= Sandwiches I = Ice-cream The program inputs the type of food and quantity. It finally displays the total charges for the order according to following criteria: Burger = Rs. 220 French Fries= Rs. 50 Pizza= Rs. 300 Sandwiches= Rs. 150 Ice-cream = Rs. 90
Shelayah R.
i. Write a behavioral model Verilog code for a Half-adder using an if-else statement. ii. Write a Verilog code for a Full-adder using a Test bench model.
Sri K.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD