Source Code Gumball Machine: public class GumballMachine implements IGumballMachine { State soldOutState; State noCoinState; State hasCoinState; State soldState; State state = soldOutState; int count = 0; int gumballInSlot = 0; int coin = 0; public GumballMachine(int numberGumballs) { soldOutState = new SoldOutState(this); noCoinState = new NoCoinState(this); hasCoinState = new HasCoinState(this); soldState = new SoldState(this); this.count = numberGumballs; if (numberGumballs > 0) { state = noCoinState; } } public void insertQuarter() { state.insertCoin(25); } public void insertDime() { …show more content…
} void refill(int count) { this.count = count; state = noCoinState; } public void setCoin(int c) { coin = c; } public int getCoin() { return coin; } public State getState() { return state; } public State getSoldOutState() { return soldOutState; } public State getNoCoinState() { return noCoinState; } public State getHasCoinState() { return hasCoinState; } public State getSoldState() { return soldState; } public String toString() { StringBuffer result = new StringBuffer(); result.append(" Mighty Gumball, Inc."); result.append(" Java-enabled Standing Gumball Model #2004"); result .append(" Inventory: " + count + " gumball"); if (count != 1) { result.append("s"); } result.append(" "); result.append("Machine is " + state + " "); return result.toString(); } public boolean isGumballInSlot() { if (gumballInSlot > 0) { System.out.println("isGumballInSlot: true"); return true; } else { System.out.println("isGumballInSlot: false"); return false; } } public void takeGumballFromSlot() { if (gumballInSlot > 0) { System.out.println("Take all (" + gumballInSlot + ") gumball from the slot"); gumballInSlot =
Jurassic Company owns machinery that cost $1,145,700 and has accumulated depreciation of $458,280. The expected future net cash flows from the use of the asset are expected to be $636,500. The fair value of the equipment is $509,200.
The vending machine- A practical device where a coin is inserted into machine via a mechanical function that yields a
Students will try and play each game listed and tally if they won or lost the game twelve times per game. The games will include predicting heads or tails, and then flipping a coin, The birthday game (how likely a wheel with all of the month of the year will land on your birthday month), and a dice game (a student will predict what the die will land on, and then throws the die and records if they are right). Students will also play a game that is rigged that has zero odds of winning. The goal of the game will be to pull a yellow block from a bag that only contains green, blue, and red blocks. I will include the rigged game to show students what an unfair game looks like, and give them a real-life experience of an event that has zero odds. Once completed students will compare their scores on how often they won on each
Adaptations to activity 1- Students work in groups of 3 or 4. Each student will be given a bag of money. The bags will contain a 1-$50 bill, 1-$20 bill, 1-$10 bill, 2-$5.00 bill, 5-$1.00 bills, 2 half-dollars, 8 quarters, 10 dimes, 16 nickels and 20 pennies for a total of $100.00. Students will be given objects that have an amount written on a price tag on them. Students in groups may take on roles. Two or three student may be the customers buying an object. Student must count purchase amount out correctly and hand it to the cashier. One student can be the clerk accepting the money. He/she must count back the change by counting up. All students must write the amount using the decimal form using the $
This afternoon, Kenyatda went to the bust Buy with the staff to purchase a stereo. Previous session, the staff took Kenyatda to the store to do price check on stereos. Kenyatda saw one stereo that she liked in which it was around $184.00. Kenyatda received a check for 190.00 to purchase the stereo. This afternoon when the staff took Kenyatda to the store, the stereo price had gone down to 169.00 including 9.01 tax. Which total up to $179.00. The staff educated on budging skills. The staff taught Kenyatda how to save the $11.00 and use it next week along with his grocery check. Kenyatda wanted to use the funds for cigarette instead. The staff educated him how important is to save funds for rainy days. Moving forward, the plan is to train Kenyatda
4. The following pseudo code contains several nested If-Then-Else statements. Unfortunately, it was written without proper alignment and indentation. Rewrite the code and use the proper conventions of alignment and indentation.
The coordinator called up the game “making choice”, starting with two choices, then three choices, and finally four choices. After “making choice” game, the children were divided into groups by table of five (5) to six (6). The coordinator gave the instruction for the next activity, making shopping list with healthy snack choice. After group discussion, the children were getting ready for their Walmart trip where they would get their afternoon snack according to their
6. Depreciation computations. Alpha Alpha Alpha, a college fraternity, purchased a new heavy-duty washing machine on January 1, 20X3. The machine, which cost $1,000, had an estimated residual value of $100 and an estimated service life of 4 years (1,800 washing cycles). Calculate the following:
At the end of the machine life in year 4, there is extra cash inflow from sell the machine in its salvage value $124,956.
The Bakery produces cupcakes. It uses a process costing system. In March, its beginning inventory was 450 units, which were 100% complete for direct materials costs and 10% complete for conversion costs. The cost of beginning inventory was $655. Units started and completed during the month totaled 14,200. Ending inventory was 410 units, which were 100% complete for direct materials costs and 70% complete for conversion costs. Costs per equivalent unit for March were $1.40 for direct materials costs and $1.00 for conversion costs. Using the FIFO costing method, compute the cost of goods transferred to the Finished Goods Inventory account, the cost remaining in the Work in Process
| The same cost formula need not to be applied to all inventories having a similar nature and use to the entity
We began with having an equal set of 6 pennies to the child and six pennies for me. The alternations regarding the set of pennies involved me spreading the row of one set. Then I repeated to ask the child, “Who had more pennies or are they the same number of pennies?”. I repeated this question after alternating my set, then the child’s set. After the conservation of number, I proceeded to the conservation of mass. For the 2nd task I used pennies, since I did not have access to clay until the children went to the classroom after recess. When performing the conservation of mass with pennies, I would the stack the pennies into a tower asked the children to compare it to the single row of pennies. For example, the child would have 3 stacks with two pennies per stack and I arranged my six pennies in a row and proceeded by asking him, “Who had more pennies?”. Eventually, I had access to clay after the children went back to the
The sales volume of the new process. The selling price of $0.65 has been selected for this example, and we just need to know how many racquetballs
The general structure of my implementation can be split up into three segments; Input, storage, and output. In the input section there are 2 bits of memory to temporarily store the 3 different inputs, 01 representing £1, 10 representing £2 and 11 representing cancel pressed. This memory is cleared once it has been clocked into the main storage of the system. The storage is implemented with 3 bits of memory as there are 6 possible states for the memory, £0 to £5, the 1 and 2 bit are only affected once an input has been clocked in however the 4 bit is only affected by the carry bit of the 2 bit memory and is cleared as soon as an input button has been pressed as this was part of the assignment specification.
$ & 60 & & & 1 1 0 60 0 0 48 & & & 40 0 0 1 0 2400 & & & -20 0 0 0 1 0%