Wednesday 9 December 2015

LBEPS Lab@Home 6

1 Write a pseudocode to accept a number, and then find whether or not the number is divisible by five. (Duration: 15 Minutes)


Ans   https://drive.google.com/open?id=0B08RKBSts8D8U2ZXTVQ3TWxpMWM


2.Write a pseudocode to accept an item/product number from a displayed list of items, accept quantity from a user, and display the total price. The price of the items will be defined in the pseudocode. (Duration: 15 Minutes)


Ans   begin
numeric nItemname, nPrice, nQuantity, nTotalValue
display "The list of items is given below"
display " "
display "1. Product 1"
display "2. Product 2"
display "3. Product 3"
display "4. Product 4"
display "Select the item number for sale"
accept nItemname
switch (nItemname)
case1:
nPrice = 50
break
case2:
nPrice = 70
break
case3:
nPrice = 40
break
case4:
nPrice = 90
break
default:
display "Please enter a valid option"
break
end
display "Enter the Quantity Purchased"
accept nQuantity
compute nTotalvalue = nPrice * nQuantity
display "The total price of the product is" +nTotalvalue
end


3.Write a pseudocode to accept the age of a candidate. If the age entered is 18 or above, the message, You are eligible to vote, should be displayed. If the age entered is below 18, the message, You are not eligible to vote, should be displayed. (Duration: 15 Minutes)



Ans   https://drive.google.com/open?id=0B08RKBSts8D8VFhRTktFdFBHWFU



.4. Write a pseudocode to accept three numbers and display the largest number. (Duration: 15 Minutes)



Anshttps://drive.google.com/open?id=0B08RKBSts8D8U21hNXVfY3l3Ymc



5.Write a pseudocode to accept a year and determine whether the year is a leap year. (Duration: 15 Minutes)




Ans   begin
numeric nYear
display "Enter a year to find if it is a leap year"
accept nYear
if ( nYear % 400 == 0 OR ( nYear % 4== 0 AND nYear % 100 !=0))

begin
display " It is a Leap Year"
end
end
end




6. Write a pseudocode to display the cost of a selected menu item from a restaurant menu card. The menu card should display the list of food items. The food items should be numbered. The last line of the menu should display the text, Enter the menu selection. The user should enter the sequence number corresponding to the menu items in the menu card as input. Further, the cost of the selected item should be displayed. In addition, an error message, Wrong selection, should be displayed if a wrong option, which does not appear in the menu, is entered by the user. (Duration: 15 Minutes)



Ans   begin
numeric nSelection
display "      Menu        "
display " 1. Fried Rice "
display " 2. Mix Veg. "
display " 3. Shahi Paneer "
display " 4. Chicken Briyani "
display " 5. Pop Corn Soup "
display " 6. Raj Mah "
display " Enter the menu selection "
accept nSelection
switch ( nSelection)
begin
case 1:
display " Please pay $50"
break
case 2:
display " Please pay $20"
break
case 3:
display " Please pay $40"
break
case 4:
display " Please pay $60"
break
case 5:
display " Please pay $70"
break
case 6:
display " Please pay $90"
break
default :
display "Wrong selection"
end
end



7.  Write a pseudocode to display a movies menu containing the numbered list of movies and display the playtime, name of actors, and name of director of the movie selected by the user. The last line of the menu should display the text, Enter your selection. When the user enters the movie number, the corresponding information should be displayed. In addition, an error message, Enter a valid option, should be displayed if a wrong option, which does not appear in the menu, is entered by the user. (Duration: 15 Minutes)




Ans  begin
numeric nSelection
display "    Movie    "
display "1. Singham  "
display "2. inkaar   "
display "3. Talaash   "
dispaly "4. Terminator  "
display " Enter the selection"
accept nselection
switch (nSelection)
begin
case1 :
display " Actor :Ajay Devgan, Time 2Hours, Director Dev"
break
case2 :
display " Actor :Arjun Rampal, Time 2Hours, Director Sameer"
break
case3 :
display " Actor :Amir Khan, Time 2Hours, Director Deven"
break
case4 :
display " Actor :Arnold, Time 2Hours, Director Nisha Nimesh"

break
default:
display " Enter a valid option"

end
end




8.Write a pseudocode to accept a direction from a menu containing the options, up, down, right, and left. The pseudocode should display the geographical direction corresponding to the selected option, such as North, South, East, or West as output on the screen. (Duration: 15 Minutes)



Ans begin

numeric nSelection
display "      Menu        "
display " 1. Up "
display " 2. Down "
display " 3. Left "
display " 4. Right "
display " Enter the menu selection "
accept nSelection
switch ( nSelection)
begin
case 1:
display " North"
break
case 2:
display " South "
break
case 3:
display " West"
break
case 4:
display " East"
break

default :
display "Wrong selection"
end
end

No comments:

Post a Comment