HW3_Curtis_Ryan

HW3_Curtis_Ryan - 10W-GV 2/2/2011 HW3 Curtis Ryan Problem...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
10W-GV 2/2/2011 HW3 Curtis Ryan 1 Problem ID: Scholar: HW3 Problem 1 Problem Statement: To determine the admission price for a single person to a museum depending on the size of the group using logical operators and stacked if statements. Diagram : N/A Solution: Flowchart:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10W-GV 2/2/2011 HW3 Curtis Ryan 2 Start Input People (S)=0 If S<3 elseIf S<9 elseIf S<20 Stop Output Individual Price (R)= $7 Output R= $6.50 Output R= $6 elseIf S>20 Output R= $5 Cost=R*S Output Total Price
Background image of page 2
10W-GV 2/2/2011 HW3 Curtis Ryan 3 Listing: %This script file will determine the admission price for a single person to a museum depending %on the size of the group. It may include logical operators and uses stacked %if structures. S = input ( 'Enter your group size: ' ); if S <= 3 R = 7.00*S ; %This sets the fee for a single person fprintf ( '\n The total cost of the ticket(s) will be $%.02f \n' , R); end if S >= 4 && S <= 8 %This says if the group is between 4 and 8 R = 6.50*S ; %Then the price will be 6.50 fprintf ( '\n The total cost of the tickets will be $%.02f \n' , R); end if S >= 9 && S <=20 %this says if the group is between 9 and 20 R = 6.00*S ; %then the price is 6 dollars and is a small group fprintf ( '\n The total cost of the tickets will be $%.02f \n' , R); end if S > 20; %if the group is greater then 20 R = 5.00*S ; %then the price will be 5 dollars fprintf ( '\n The total cost of the tickets will be $%.02f \n' , R); end Sample Run: Enter your group size: 1 The total cost of the ticket(s) will be $7.00 Enter your group size: 4 The total cost of the tickets will be $26.00 Enter your group size: 9 The total cost of the tickets will be $54.00 Enter your group size: 25 The total cost of the tickets will be $125.00
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2011 for the course ENGE 1114 taught by Professor Twknott during the Spring '06 term at Virginia Tech.

Page1 / 8

HW3_Curtis_Ryan - 10W-GV 2/2/2011 HW3 Curtis Ryan Problem...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online