how to display data values
this tutorial shows how to display text and number values together and presents a simple programming task to complete
program requirements
code a simple program to output text and number values together use this to display price information learning-point
text and number values can be output together use + (plus sign), between each value to join them (concatenate) remember text needs "speech marks", numbers do not a space is often needed inside the speech marks to make gaps introducing the code
here is the new code that will be featured
System.out.println("the 1st prime is " + 2);
understanding the code
The brackets contain a text value and a number value, there is a + symbol between the values normally you would expect a + to mean add, as in 1+1 would result in 2. since the first value is text, java read the + as join (concatenate) The code above will produce this output in the console
the 1st prime is 2
The values are displayed as expected. develop the code
read the user interface design read the code, run the code, (coding frame) edit the code to complete part 3B, use part 3A to help, there are //comments in the coding frame to help you user interface design
the final display should look something like this Welcome to the WaffleMaster!
A triple chocolate waffle costs £7.55
A Nutella sandwich waffle costs £7.75 and 1.25 for extra cream
The total for 3 Banoffee waffles at £7.75 each is £23.25
coding frame