4 enter values

icon picker
D enter data

enter and store values of different types, then present a summary

program requirement

many apps will require a user to enter values of different types and then produce output a message that combines these various values.
This program should ask a user to enter and store text and number values including integers and decimal fractions as part of a pizza ordering system.

learning point

There are no new learning points in this task and no new code.
You will apply what you have learned already about entering text, integer and real numbers.

user interface

Here is an an example of a dialog where the user is asked to enter values of different types
Choose a Domino's pizza, what's the name? pepperoni
How many slices did you want ? 4
What is the cost ? 1.23
You'll pay £ 1.23 for 4 slices of pepperoni pizza

developer task

The full dialog that the pizza program should create is shown above. The project frame below already has working code for the task.
Read, copy and re-use the code you already have for entering the values for the follow on task shown below in the make task of PRIMM section.
Follow the PRIMM stages below to develop your code.

program code


Loading…

PRIMM

predict
Read the code and assume that the user wants to order 6 slices of Margherita pizza at a cost of 2.45
Can you anticipate what would appear on the console when the program is run?

run
go ahead and run the program, enter the values given as an example
run the program again and enter different values, check that the output is correct

investigate
change the output to read as follows
4 slices of pepperoni pizza will cost £ 1.23
modify
There is no modification task

make

Can you create the code to ask a user to enter travel data as shown?
Remember your program has to ask the user for the data and each item of data is a different type. You will need to declare variables for each value.
What's the name of your home street? : Main Steet
How many minutes cycle from home to school? : 14
How many miles from home to school? : 2.4
To find out the data you will need to enter search to search for your school and then get directions home
trip.png
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.