0% found this document useful (0 votes)
162 views4 pages

CS10-8L: Computer Programming Laboratory Machine Problem #2: Variables, Input and Output

This document provides instructions for Machine Problem 2, which involves writing a MATLAB program to generate a customer bill. The program must prompt the user to input the quantities of 5 products sold - TVs, laptops, speakers, mice, and keyboards. It then calculates and displays the unit price, total price, subtotal, sales tax, and total for each item and in total. Screenshots of the program output in the editor and command windows are required.

Uploaded by

Barbie Lat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views4 pages

CS10-8L: Computer Programming Laboratory Machine Problem #2: Variables, Input and Output

This document provides instructions for Machine Problem 2, which involves writing a MATLAB program to generate a customer bill. The program must prompt the user to input the quantities of 5 products sold - TVs, laptops, speakers, mice, and keyboards. It then calculates and displays the unit price, total price, subtotal, sales tax, and total for each item and in total. Screenshots of the program output in the editor and command windows are required.

Uploaded by

Barbie Lat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CS10-8L: Computer Programming Laboratory

Machine Problem #2: Variables, Input and Output

Name: Score:

Section: FOPI01 Date:


June
10, 2023

OBJECTIVES
● To familiarize the students with the MATLAB interface.
● To enable the students to use some basic operations.

Instructions:
1. Save your file as Surname_Firstname_MP2. Ex. Isip_Cheryl_MP2

2. You will submit a zip file containing the following and send it to BB.

a. PDF file of Machine Problem 2 provided with the screenshot of your answers.
b. MATLAB script with .m extension.

3. Your program must have comments for each section.


Header Comments:
%{
This demo program shows how good a MATLAB program is
Written by: Cheryl Isip
Date: August 27,2021
Time: 2:20pm
Program: BSIE
Course: CS10-8L
Section: B20
School: Mapua University
%}
4. Your output should be displayed rounded to two decimal places.

5. You’re not allowed to use conditional or repetition statements else you will be

6. Follow the output design as shown below.

MACHINE PROBLEM

Prepared by: Cheryl Mari M. Isip, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #2: Variables, Input and Output

1. Write a program to create a customer’s bill for a company. The company sells only five different products: TV,
Laptop, Speaker, Computer Mouse and Keyboard. The unit prices are 20,000.00 pesos, 40,000 pesos, 6,000 pesos,
1000 pesos and 3000 pesos respectively. The program must read the quantity of each piece of equipment purchased
from the keyboard. It then calculates the cost of each item, the subtotal, and the total cost after an 8.25% sales tax.

The input data consist of a set of integers representing the quantities of each item sold. These integers must be input
into the program in a user - friendly way; that is, the program must prompt the user for each quantity as shown
below. The numbers in boldface show the user’s answers.

Sample Output:

How Many TVs Were Sold? 3


How Many Laptops Were Sold? 5
How Many Speakers Were Sold? 1
How Many Computer Mouse Were Sold? 2
How Many Keyboards Were Sold? 4

____________________________________________________________________

QTY DESCRIPTION UNIT PRICE TOTAL PRICE


____ _______________ _____________ ______________

XX TV 20,000.00 XXXXXX.XX
XX LAPTOP 40,000.00 XXXXXX.XX
XX SPEAKER 6,000.00 XXXXXX.XX
XX MOUSE 1,000.00 XXXXXX.XX
XX KEYBOARD 3,000.00 XXXXXX.XX
__________
SUBTOTAL XXXXXX.XX
TAX XXXX.XX
TOTAL XXXXXX.XX

In the editor window, take a screenshot and paste your output:

Prepared by: Cheryl Mari M. Isip, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #2: Variables, Input and Output

In the command window, take a screenshot and paste your output:

Prepared by: Cheryl Mari M. Isip, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #2: Variables, Input and Output

Prepared by: Cheryl Mari M. Isip, Mapua University

You might also like