Hello guys can you guys check if am doing right on this problem?

a costumer is purchasing 5 items from a store. design a program that asks for price of each item and then displays the subtotal of the sale, the amount of sales tax and the total?

 

/ start 

// declare variables
declare real item1,item2,item3,item4,item5
declare real subtotal sales
declare real tax
declare real total sales

//get first item1
"enter the first item price"
input item1

//get the second item
display "enter the second item"
input item2

//get the second item
display " enter the second item"
input item3

// get third item
display "eneter third item"
input item3

//get fourth item
display "enter the fourth item"
input item4

// get the fifth item
display " enter fifth item"
input item5

set subtotal=item1+item2+item3+item4+item5
display " this is the subtotal", subtotal
//calculate tax

set saletax=subtotal*0.06

display" subtotal,salestax,total

tuckeranddale's picture

The logic behind it seems to be correct

The logic seems to be correct but what kind of programming language should this be. Never see this kind of Code. Also if you run a shop then it will be never always be the same. Some customer only purchase 3 items, right? Normally you can set up shop systems with all the code done already with WordPress or Drupal within minutes. You dont need to hardcode all.

Vote the answer: 
4
Average: 4 (1 vote)