Exercise:
Write a program that asks the user how many t-shirts they would like to buy, and then prints out the total cost. You should declare a constant at the top of your program called COST_OF_SHIRT and set it equal to $15.
My code:
//Declare a constant here to represent the cost of a tshirt
function start(){
var num= readInt ("Hi how many T-shirts whould you like? ");
var COST_OF_SHIRT;
var COST_OF_SHIRT=15;
var total=COST_OF_SHIRT*num;
println=readLine (total + " (Type thanks and click OK)");
println=(total);
println;
}
Write a program that asks the user how many t-shirts they would like to buy, and then prints out the total cost. You should declare a constant at the top of your program called COST_OF_SHIRT and set it equal to $15.
My code:
//Declare a constant here to represent the cost of a tshirt
function start(){
var num= readInt ("Hi how many T-shirts whould you like? ");
var COST_OF_SHIRT;
var COST_OF_SHIRT=15;
var total=COST_OF_SHIRT*num;
println=readLine (total + " (Type thanks and click OK)");
println=(total);
println;
}