Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

// data declarations (inputs, outputs, and constants) // data initializations (f

ID: 3678252 • Letter: #

Question


// data declarations (inputs, outputs, and constants) // data initializations (for any KNOWN values) I/ calculations I/ output prints (possibly interspersed with calculations) Sample output: Your resulting numerical outputs should look something like this (you can label it however you wish): GRASP exec: Java OperatoraRL 1) Lunch price 15 2) 872 eggs sills 3) 872 eggs leaves 4) tax on 329.49 1 5) circle area is 6) batting avg $9.07 72 cartons 7.068583575 7b) Widgeti inventory after:S6 8a) Widget2 inventory before:400 tting the assignment

Explanation / Answer

begin

initialize sandwich = $3

soda = $1

chips = $2

declare total_price

calculate total_price

total_price = sandwich + chips + soda

print “Lunch price is:” total_price

end

begin

initializetotal=872,dozen=12

declare fills

calculate fills

fills = int(total/dozen)

print “ No of eggs fills:” fills “cartons”

end

begin

initialize total=872,dozen=12

declare leaves

calculate leaves

leaves=total%dozen

print”no of eggs Leaves:” leaves

end

begin

initialize price = $329.49

tax = 7.5%

declare vat

calculate vat

vat = price*tax

print “ tax on” price “is:” vat

end

begin

initialize radius = 1.5m

read pi value

declare Area

calculate Area

Area = pi*r^2

print “Area of a circle is:” Area

end

begin

int hits = 112

int at_bats = 329

declare avg

calculate avg

avg = hits/at_bats

print “ the batting average is:” avg

end

begin

int wg

     read the total widgets in inventory

     store it in wg

print “ No of widgets in inventory before” wg

calculate wg

     wg = wg-1

                print “ No of widgets in inventory after “ wg

                           end

begin

               int wg

               read the total widgets in inventory

               store it in wg

              print “ No of widgets in inventory before” wg

                          calculate wg

               wg = wg+20

                          print “ No of widgets in inventory after “ total

               end