I have the source code for three separate java programs (TestVendingMachine.java,
VendingMachineException.java, and VendingMachine.java), which work together to recreate the
sample output provided. All three programs compile and work as they should but I need to make
a minor adjustment to the VendingMachine.java program and would appreciate any help. When
the user input returns any of the three possible errors (out of stock, insufficent funds, and invalid
item), the program should automatically move onto the next user input prompt without
displaying the dispensing options and change returned.
VendingMachine.java
import java.util.Random;
import java.util.regex.*;
public class VendingMachine
{
// soft drinks candy bars snacks
private String[][] items = { {\"Pepsi\", \"Snickers\", \"Potato Chips\"},
{\"Diet Pepsi\", \"Resse\'s Cup\", \"Ruffles\"},
{\"Dr. Pepper\", \"M&M chocolate\",\"Fritos\"},
{\"Diet Dr. P\", \"Peanut M&Ms\", \"Doritos\"},
{\"Sprite\", \"Twisters\", \"Almonds\"},
{\"Diet Sprite\", \"Hershey\'s\", \"Peanuts\"} };
private int[][] prices = { {75,65,30},
{80,60,35},
{70,55,40},
{75,60,45},
{60,45,50},
{65,40,35} };
private int[][] quantity = { {3,1,0},
{4,6,5},
{7,5,4},
{5,0,5},
{0,4,0},
{6,4,3} };
private int depositedAmt = 0;
private boolean haveValidSelection = false;
private int selectedRow = 0;
private char selectedCol = \'A\';
// default constructor
public VendingMachine()
{
}
public int buyItem(String selection)
{
Pattern validChars = Pattern.compile(\"[^A-Ca-c1-6]+\");
Matcher m1 = validChars.matcher(selection);
Pattern selectionRange = Pattern.compile(\"[1-6]+\");
Matcher m2;
boolean illegal = false;
int change = -1;
if(depositedAmt > 0)
{
if(selection.length() != 2)
illegal = true;
if(!illegal)
illegal = m1.find();
if(!illegal)
if( Character.getNumericValue(selection.charAt(1)) < 1)
illegal = true;
m2 = selectionRange.matcher(selection.substring(0,1));
if(!illegal)
illegal = m2.find();
haveValidSelection = !illegal;
if(haveValidSelection)
{
selectedRow = Character.getNumericValue(selection.charAt(1) - 1);
selectedCol = Character.toUpperCase(selection.charAt(0)); // allows for upper- or
lowercase entry
int col = selectedCol - 65;
if(quantity[selectedRow][col] > 0)
if( depositedAmt >= prices[selectedRow][col])
{
depositedAmt -= prices[selectedRow][col];
--quantity[selectedRow][col];
change = getChange();
}
else
System.out.print(String.format(\"*** Error: Vending Machine - Insufficient funds for
item: %s%nCost: $0.%d, Deposited: $%.2f\",
items[selectedRow][col], prices[selectedRow][col],
getDeposit()/100.0));
else
System.out.print(String.format(\"*** Error: Vending Machine - Out of stock on this
item: %s%nCost: $0.%d\",
items[selectedRow][col], prices[selectedRow][col]));
}
else
System.out.print(\"*** Error: Vending Machine - Invalid item selection: \"+selection);
}
else
System.out.print(\"Please enter proper funds before making selection: \"+selection);
return change;
}
public void depositMoney(int payment)
{
if(payment > .
For this homework, you will develop a class called VendingMachine th.pdfinfo309708
For this homework, you will develop a class called VendingMachine that simulates an imaginary
vending machine at CSUMB. In the program, a user can buy a bottle of water ($1.50), a coffee
($2.00), a bag of chips ($1.00),
and a chocolate bar ($2.50) from the machine. The user can buy several items if they are
available
in the machine. For the payment, a user can use only cash (including coins). Additionally, an
administrator of the machine can reset or refill the machine.
1 Demo Program
The following code presents a demo program that uses the VendingMachine class.
public class VendingMachineDemo {
public static void main(String[] args) {
VendingMachine machine1 = new VendingMachine(100);
VendingMachine machine2 = new VendingMachine(200, \"Library\");
System.out.println(\"===== Welcome to the CSUMB Vending Machine =====\");
System.out.println(machine1);
System.out.println(\"\");
System.out.println(machine2);
System.out.println(\"\ === Compare Two Machines ===\");
System.out.println(machine1.equals(machine2));
machine1.setLocation(\"BIT104\");
machine1.setName(50);
machine1.setName(100);
System.out.println(\"\ === Machine Reset ===\");
machine1.reset(4, 5, 0, 6); // In this method, we assume that a machine
// administrator resets the contents of
// a machine.
machine1.addItems(1,2,3,4); // A system admin can add items to the machine
System.out.println(machine1);
System.out.println(\"\");
machine1.displayMenu();
System.out.println(\"\ === Buy an Item ===\");
machine1.buyItem();
System.out.println(\"\ === Buy another Item ===\");
1
if(machine1.buyItem(1, 4) == false) {
System.exit(1);
}
System.out.println(\"\ === Return Two Items ===\");
machine1.returned(1, 2);
machine1.returned(2, 3);
System.out.println(\"\ === Buy another Item ===\");
machine1.buyItem(3, 5);
System.out.println(\"\ === Pay for items selected. ===\");
if(machine1.payment()) {
System.out.println(\"\ === Valid payment. ===\");
machine1.displayReceipt();
} else {
System.out.println(\"\ === Invalid payment. Try one more time. ===\");
if(machine1.payment()) {
System.out.println(\"\ === Print Receipt ===\");
machine1.displayReceipt();
} else {
System.exit(1);
}
}
machine1.addItems(5,5,5,5);
System.out.println(\"\ === Machine Status ===\");
machine1.status();
System.out.println(\"\ ===== Thank you! =====\");
}
}
Sample Run of the Demo Program: The following presents a sample result of the demo
program.
Read the result very carefully to identify the operations of the program.
===== Welcome to the CSUMB Vending Machine =====
Serial Number: 100
Location: UNKNOWN
Contents:
Water: 0
Coffee: 0
Sun Chips: 0
Chocolate Bar: 0
Serial Number: 200
Location: Library
Contents:
Water: 0
Coffee: 0
Sun Chips: 0
2
Chocolate Bar: 0
=== Compare Two Machines ===
false
=== Machine Reset ===
Serial Number: 100
Location: BIT104
Contents:
Water: 5
Coffee: 7
Sun Chips: 3
Chocolate Bar: 10
===== Vending Machine Menu =====
1. Water............$1.50
2. Regular Coffee...$2.00
3. Sun Chips........$1.00
4. Chocolate Ba.
I am trying to cover the protected synchronized boolean enoughIngred.pdfallystraders
I am trying to cover the protected synchronized boolean enoughIngredients(Recipe r) method in
my inventoryTest file. But it doesn't reach the code. I tried making a child class in my
InventoryTest class extending the Inventory class and overrriding the method in the Inventory
class using a public modifier, but it still wouldn't work. I tried changing the access modifier of
enoughIngredients() to public as a test in the Inventory class but it still didn't work. Why aren't I
reaching the code? Do it have something to do with boolean as the method type? Thank you
public class Inventory {
private static int coffee;
private static int milk;
private static int sugar;
private static int chocolate;
public Inventory() {
setCoffee(15);
setMilk(15);
setSugar(15);
setChocolate(15);
}
public int getChocolate() {
return chocolate;
}
public synchronized void setChocolate(int chocolate) {
if (chocolate >= 0) {
Inventory.chocolate = chocolate;
}
}
public synchronized void addChocolate(String chocolate) throws InventoryException {
int amtChocolate = 0;
try {
amtChocolate = Integer.parseInt(chocolate);
} catch (NumberFormatException e) {
throw new InventoryException("Units of chocolate must be a positive integer");
}
if (amtChocolate >= 0) {
Inventory.chocolate += amtChocolate;
} else {
throw new InventoryException("Units of chocolate must be a positive integer");
}
}
public int getCoffee() {
return coffee;
}
public synchronized void setCoffee(int coffee) {
if (coffee >= 0) {
Inventory.coffee = coffee;
}
}
public synchronized void addCoffee(String coffee) throws InventoryException {
int amtCoffee = 0;
try {
amtCoffee = Integer.parseInt(coffee);
} catch (NumberFormatException e) {
throw new InventoryException("Units of coffee must be a positive integer");
}
if (amtCoffee >= 0) {
Inventory.coffee += amtCoffee;
} else {
throw new InventoryException("Units of coffee must be a positive integer");
}
}
public int getMilk() {
return milk;
}
public synchronized void setMilk(int milk) {
if (milk >= 0) {
Inventory.milk = milk;
}
}
public synchronized void addMilk(String milk) throws InventoryException {
int amtMilk = 0;
try {
amtMilk = Integer.parseInt(milk);
} catch (NumberFormatException e) {
throw new InventoryException("Units of milk must be a positive integer");
}
if (amtMilk >= 0) {
Inventory.milk += amtMilk;
} else {
throw new InventoryException("Units of milk must be a positive integer");
}
}
public int getSugar() {
return sugar;
}
public synchronized void setSugar(int sugar) {
if (sugar >= 0) {
Inventory.sugar = sugar;
}
}
public synchronized void addSugar(String sugar) throws InventoryException {
int amtSugar = 0;
try {
amtSugar = Integer.parseInt(sugar);
} catch (NumberFormatException e) {
throw new InventoryException("Units of sugar must be a positive integer");
}
if (amtSugar >= 0) {
Inventory.sugar += amtSugar;
} else {
throw new InventoryException("Units of sugar must be a positive integer");
}
}
protected synchronized boolean enoughIngredients(Recipe r) {
.
Hello everyone,Im actually working on a fast food order program..pdffedosys
Hello everyone,
I\'m actually working on a fast food order program. So far my program works good. Once the
user has finished the order the program displays a receipt with all the order\'s information.
What I want is to print the receipt information in a showMessagedialog box by making used of
JOptionPane. I have tryed but i has been impossible. Can you please guys give a hand with this.
Here is my program code:
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Random;
import java.util.Scanner;
//Interface
interface Restaurant
{
//Method that adds items to order.
void addItem();
}
//class that contains item\'s menu and prices.
class ItemsMenu{
Restaurant[] Menu = {
new CheeseBurger(4.45),
new ChickenBurger(5.25),
new SuperHotDog(3.55),
new MiniHotDog(2.99),
new Fries(1.75),
new OnionRings(1.75),
new Soda(1.55),
new BottleWater(1.25)};
//Method that display menu and receipt.
void Menu()
{
Scanner CashierInput = new Scanner(System.in);
DecimalFormat df = new DecimalFormat(\"0.00\");
Date dateCreated = new Date();
//Declaring variables.
int Choice = 0;
int ItemNum = 0;
double Tax = 0;
double NYTax = 8.78;
double SubTotal = 0;
double Total = 0;
double TotalFinal = 0;
//Printing menu options.
System.out.println(\"\ /*/*/*/*/*/*/*/*/ Mac King Fast Food /*/*/*/*/*/*/*/*/\");
System.out.println(\" \ Burgers:\" + \" \" + \"Side Orders: \");
System.out.println(\" 1. CheeseBurger $\" + df.format(((CheeseBurger)
Menu[0]).cheeseBurger) + \" \" + \"5. Fries $\" + df.format(((Fries) Menu[4]).fries));
System.out.println(\" 2. ChickenBurger $\" + df.format(((ChickenBurger)
Menu[1]).chickenBurger) + \" \" + \"6. Onion Rings $\" + df.format(((OnionRings)
Menu[5]).onionRings));
System.out.println(\" \ Hot Dogs:\" + \" \" + \"Beverages: \");
System.out.println(\" 3. Super HotDog $\" + df.format(((SuperHotDog)
Menu[2]).superHotDog) + \" \" + \"7. Soda $\" + df.format(((Soda) Menu[6]).soda));
System.out.println(\" 4. Mini HotDog $\" + df.format(((MiniHotDog) Menu[3]).miniHotDog)
+ \" \" + \"8. Bottle of Water $\" + df.format(((BottleWater) Menu[7]).bottleWater));
//Loop to get order choice from user.
do {
if (Choice != 0)
{
System.out.print(\" !!Enter (0) to finish Order!!\ \");
}
System.out.print(\" \ Enter menu selection: \");
Choice = CashierInput.nextInt();
//Printing choices added.
//Counting items added.
//Counting number of items added.
//Calculating subtotal.
if (Choice == 1)
{
System.out.println(\"\ CheeseBurger added\");
SubTotal = ((CheeseBurger) Menu[0]).cheeseBurger;
Menu[0].addItem();
++CheeseBurger.cheeseBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 2)
{
System.out.println(\"\ ChickenBurger added\");
SubTotal = ((ChickenBurger) Menu[1]).chickenBurger;
Menu[1].addItem();
++ChickenBurger.chickenBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 3)
{
System.out.println(\.
Hello everyone,Im working on my fast food order project program..pdfpristiegee
Hello everyone,
I\'m working on my fast food order project program. So far my program works perfectly. Now,
my instructor is requiring me to use GUI interface on my program. I have tryed but it has been
impossible. Can you please guys give a hand with this. Here is my program code:
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Random;
import java.util.Scanner;
//Interface
interface Restaurant
{
//Method that adds items to order.
void addItem();
}
//class that contains item\'s menu and prices.
class ItemsMenu{
Restaurant[] Menu = {
new CheeseBurger(4.45),
new ChickenBurger(5.25),
new SuperHotDog(3.55),
new MiniHotDog(2.99),
new Fries(1.75),
new OnionRings(1.75),
new Soda(1.55),
new BottleWater(1.25)};
//Method that display menu and receipt.
void Menu()
{
Scanner CashierInput = new Scanner(System.in);
DecimalFormat df = new DecimalFormat(\"0.00\");
Date dateCreated = new Date();
//Declaring variables.
int Choice = 0;
int ItemNum = 0;
double Tax = 0;
double NYTax = 8.78;
double SubTotal = 0;
double Total = 0;
double TotalFinal = 0;
//Printing menu options.
System.out.println(\"\ /*/*/*/*/*/*/*/*/ Mac King Fast Food /*/*/*/*/*/*/*/*/\");
System.out.println(\" \ Burgers:\" + \" \" + \"Side Orders: \");
System.out.println(\" 1. CheeseBurger $\" + df.format(((CheeseBurger) Menu[0]).cheeseBurger)
+ \" \" + \"5. Fries $\" + df.format(((Fries) Menu[4]).fries));
System.out.println(\" 2. ChickenBurger $\" + df.format(((ChickenBurger)
Menu[1]).chickenBurger) + \" \" + \"6. Onion Rings $\" + df.format(((OnionRings)
Menu[5]).onionRings));
System.out.println(\" \ Hot Dogs:\" + \" \" + \"Beverages: \");
System.out.println(\" 3. Super HotDog $\" + df.format(((SuperHotDog) Menu[2]).superHotDog)
+ \" \" + \"7. Soda $\" + df.format(((Soda) Menu[6]).soda));
System.out.println(\" 4. Mini HotDog $\" + df.format(((MiniHotDog) Menu[3]).miniHotDog) +
\" \" + \"8. Bottle of Water $\" + df.format(((BottleWater) Menu[7]).bottleWater));
//Loop to get order choice from user.
do {
if (Choice != 0)
{
System.out.print(\" !!Enter (0) to finish Order!!\ \");
}
System.out.print(\" \ Enter menu selection: \");
Choice = CashierInput.nextInt();
//Printing choices added.
//Counting items added.
//Counting number of items added.
//Calculating subtotal.
if (Choice == 1)
{
System.out.println(\"\ CheeseBurger added\");
SubTotal = ((CheeseBurger) Menu[0]).cheeseBurger;
Menu[0].addItem();
++CheeseBurger.cheeseBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 2)
{
System.out.println(\"\ ChickenBurger added\");
SubTotal = ((ChickenBurger) Menu[1]).chickenBurger;
Menu[1].addItem();
++ChickenBurger.chickenBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 3)
{
System.out.println(\"\ Super HotDog added\");
SubTotal = ((SuperHotDog) Menu[2]).superHotDog;
Menu[2].addItem();
++SuperHotDog.superHotDogCount;
++ItemN.
LUS (a) Prepare the jounal entry to recerd the proceeds of the note. .pdffcsondhiindia
LUS (a) Prepare the jounal entry to recerd the proceeds of the note. (b) Prepare the journal entry
to record accrued interest at December 31, assuming adjusting entries are made only at the end of
the y
Solution
Journal entry: Date Accounts title and explanations Debit $ Credit $ 1-Jul Cash
Account Dr. 45000 Notes payable 45000 31-Dec Interest expense Account Dr.
(45000*12%*6/12) 2700 Interest payable Account 2700.
For this homework, you will develop a class called VendingMachine th.pdfinfo309708
For this homework, you will develop a class called VendingMachine that simulates an imaginary
vending machine at CSUMB. In the program, a user can buy a bottle of water ($1.50), a coffee
($2.00), a bag of chips ($1.00),
and a chocolate bar ($2.50) from the machine. The user can buy several items if they are
available
in the machine. For the payment, a user can use only cash (including coins). Additionally, an
administrator of the machine can reset or refill the machine.
1 Demo Program
The following code presents a demo program that uses the VendingMachine class.
public class VendingMachineDemo {
public static void main(String[] args) {
VendingMachine machine1 = new VendingMachine(100);
VendingMachine machine2 = new VendingMachine(200, \"Library\");
System.out.println(\"===== Welcome to the CSUMB Vending Machine =====\");
System.out.println(machine1);
System.out.println(\"\");
System.out.println(machine2);
System.out.println(\"\ === Compare Two Machines ===\");
System.out.println(machine1.equals(machine2));
machine1.setLocation(\"BIT104\");
machine1.setName(50);
machine1.setName(100);
System.out.println(\"\ === Machine Reset ===\");
machine1.reset(4, 5, 0, 6); // In this method, we assume that a machine
// administrator resets the contents of
// a machine.
machine1.addItems(1,2,3,4); // A system admin can add items to the machine
System.out.println(machine1);
System.out.println(\"\");
machine1.displayMenu();
System.out.println(\"\ === Buy an Item ===\");
machine1.buyItem();
System.out.println(\"\ === Buy another Item ===\");
1
if(machine1.buyItem(1, 4) == false) {
System.exit(1);
}
System.out.println(\"\ === Return Two Items ===\");
machine1.returned(1, 2);
machine1.returned(2, 3);
System.out.println(\"\ === Buy another Item ===\");
machine1.buyItem(3, 5);
System.out.println(\"\ === Pay for items selected. ===\");
if(machine1.payment()) {
System.out.println(\"\ === Valid payment. ===\");
machine1.displayReceipt();
} else {
System.out.println(\"\ === Invalid payment. Try one more time. ===\");
if(machine1.payment()) {
System.out.println(\"\ === Print Receipt ===\");
machine1.displayReceipt();
} else {
System.exit(1);
}
}
machine1.addItems(5,5,5,5);
System.out.println(\"\ === Machine Status ===\");
machine1.status();
System.out.println(\"\ ===== Thank you! =====\");
}
}
Sample Run of the Demo Program: The following presents a sample result of the demo
program.
Read the result very carefully to identify the operations of the program.
===== Welcome to the CSUMB Vending Machine =====
Serial Number: 100
Location: UNKNOWN
Contents:
Water: 0
Coffee: 0
Sun Chips: 0
Chocolate Bar: 0
Serial Number: 200
Location: Library
Contents:
Water: 0
Coffee: 0
Sun Chips: 0
2
Chocolate Bar: 0
=== Compare Two Machines ===
false
=== Machine Reset ===
Serial Number: 100
Location: BIT104
Contents:
Water: 5
Coffee: 7
Sun Chips: 3
Chocolate Bar: 10
===== Vending Machine Menu =====
1. Water............$1.50
2. Regular Coffee...$2.00
3. Sun Chips........$1.00
4. Chocolate Ba.
I am trying to cover the protected synchronized boolean enoughIngred.pdfallystraders
I am trying to cover the protected synchronized boolean enoughIngredients(Recipe r) method in
my inventoryTest file. But it doesn't reach the code. I tried making a child class in my
InventoryTest class extending the Inventory class and overrriding the method in the Inventory
class using a public modifier, but it still wouldn't work. I tried changing the access modifier of
enoughIngredients() to public as a test in the Inventory class but it still didn't work. Why aren't I
reaching the code? Do it have something to do with boolean as the method type? Thank you
public class Inventory {
private static int coffee;
private static int milk;
private static int sugar;
private static int chocolate;
public Inventory() {
setCoffee(15);
setMilk(15);
setSugar(15);
setChocolate(15);
}
public int getChocolate() {
return chocolate;
}
public synchronized void setChocolate(int chocolate) {
if (chocolate >= 0) {
Inventory.chocolate = chocolate;
}
}
public synchronized void addChocolate(String chocolate) throws InventoryException {
int amtChocolate = 0;
try {
amtChocolate = Integer.parseInt(chocolate);
} catch (NumberFormatException e) {
throw new InventoryException("Units of chocolate must be a positive integer");
}
if (amtChocolate >= 0) {
Inventory.chocolate += amtChocolate;
} else {
throw new InventoryException("Units of chocolate must be a positive integer");
}
}
public int getCoffee() {
return coffee;
}
public synchronized void setCoffee(int coffee) {
if (coffee >= 0) {
Inventory.coffee = coffee;
}
}
public synchronized void addCoffee(String coffee) throws InventoryException {
int amtCoffee = 0;
try {
amtCoffee = Integer.parseInt(coffee);
} catch (NumberFormatException e) {
throw new InventoryException("Units of coffee must be a positive integer");
}
if (amtCoffee >= 0) {
Inventory.coffee += amtCoffee;
} else {
throw new InventoryException("Units of coffee must be a positive integer");
}
}
public int getMilk() {
return milk;
}
public synchronized void setMilk(int milk) {
if (milk >= 0) {
Inventory.milk = milk;
}
}
public synchronized void addMilk(String milk) throws InventoryException {
int amtMilk = 0;
try {
amtMilk = Integer.parseInt(milk);
} catch (NumberFormatException e) {
throw new InventoryException("Units of milk must be a positive integer");
}
if (amtMilk >= 0) {
Inventory.milk += amtMilk;
} else {
throw new InventoryException("Units of milk must be a positive integer");
}
}
public int getSugar() {
return sugar;
}
public synchronized void setSugar(int sugar) {
if (sugar >= 0) {
Inventory.sugar = sugar;
}
}
public synchronized void addSugar(String sugar) throws InventoryException {
int amtSugar = 0;
try {
amtSugar = Integer.parseInt(sugar);
} catch (NumberFormatException e) {
throw new InventoryException("Units of sugar must be a positive integer");
}
if (amtSugar >= 0) {
Inventory.sugar += amtSugar;
} else {
throw new InventoryException("Units of sugar must be a positive integer");
}
}
protected synchronized boolean enoughIngredients(Recipe r) {
.
Hello everyone,Im actually working on a fast food order program..pdffedosys
Hello everyone,
I\'m actually working on a fast food order program. So far my program works good. Once the
user has finished the order the program displays a receipt with all the order\'s information.
What I want is to print the receipt information in a showMessagedialog box by making used of
JOptionPane. I have tryed but i has been impossible. Can you please guys give a hand with this.
Here is my program code:
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Random;
import java.util.Scanner;
//Interface
interface Restaurant
{
//Method that adds items to order.
void addItem();
}
//class that contains item\'s menu and prices.
class ItemsMenu{
Restaurant[] Menu = {
new CheeseBurger(4.45),
new ChickenBurger(5.25),
new SuperHotDog(3.55),
new MiniHotDog(2.99),
new Fries(1.75),
new OnionRings(1.75),
new Soda(1.55),
new BottleWater(1.25)};
//Method that display menu and receipt.
void Menu()
{
Scanner CashierInput = new Scanner(System.in);
DecimalFormat df = new DecimalFormat(\"0.00\");
Date dateCreated = new Date();
//Declaring variables.
int Choice = 0;
int ItemNum = 0;
double Tax = 0;
double NYTax = 8.78;
double SubTotal = 0;
double Total = 0;
double TotalFinal = 0;
//Printing menu options.
System.out.println(\"\ /*/*/*/*/*/*/*/*/ Mac King Fast Food /*/*/*/*/*/*/*/*/\");
System.out.println(\" \ Burgers:\" + \" \" + \"Side Orders: \");
System.out.println(\" 1. CheeseBurger $\" + df.format(((CheeseBurger)
Menu[0]).cheeseBurger) + \" \" + \"5. Fries $\" + df.format(((Fries) Menu[4]).fries));
System.out.println(\" 2. ChickenBurger $\" + df.format(((ChickenBurger)
Menu[1]).chickenBurger) + \" \" + \"6. Onion Rings $\" + df.format(((OnionRings)
Menu[5]).onionRings));
System.out.println(\" \ Hot Dogs:\" + \" \" + \"Beverages: \");
System.out.println(\" 3. Super HotDog $\" + df.format(((SuperHotDog)
Menu[2]).superHotDog) + \" \" + \"7. Soda $\" + df.format(((Soda) Menu[6]).soda));
System.out.println(\" 4. Mini HotDog $\" + df.format(((MiniHotDog) Menu[3]).miniHotDog)
+ \" \" + \"8. Bottle of Water $\" + df.format(((BottleWater) Menu[7]).bottleWater));
//Loop to get order choice from user.
do {
if (Choice != 0)
{
System.out.print(\" !!Enter (0) to finish Order!!\ \");
}
System.out.print(\" \ Enter menu selection: \");
Choice = CashierInput.nextInt();
//Printing choices added.
//Counting items added.
//Counting number of items added.
//Calculating subtotal.
if (Choice == 1)
{
System.out.println(\"\ CheeseBurger added\");
SubTotal = ((CheeseBurger) Menu[0]).cheeseBurger;
Menu[0].addItem();
++CheeseBurger.cheeseBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 2)
{
System.out.println(\"\ ChickenBurger added\");
SubTotal = ((ChickenBurger) Menu[1]).chickenBurger;
Menu[1].addItem();
++ChickenBurger.chickenBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 3)
{
System.out.println(\.
Hello everyone,Im working on my fast food order project program..pdfpristiegee
Hello everyone,
I\'m working on my fast food order project program. So far my program works perfectly. Now,
my instructor is requiring me to use GUI interface on my program. I have tryed but it has been
impossible. Can you please guys give a hand with this. Here is my program code:
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Random;
import java.util.Scanner;
//Interface
interface Restaurant
{
//Method that adds items to order.
void addItem();
}
//class that contains item\'s menu and prices.
class ItemsMenu{
Restaurant[] Menu = {
new CheeseBurger(4.45),
new ChickenBurger(5.25),
new SuperHotDog(3.55),
new MiniHotDog(2.99),
new Fries(1.75),
new OnionRings(1.75),
new Soda(1.55),
new BottleWater(1.25)};
//Method that display menu and receipt.
void Menu()
{
Scanner CashierInput = new Scanner(System.in);
DecimalFormat df = new DecimalFormat(\"0.00\");
Date dateCreated = new Date();
//Declaring variables.
int Choice = 0;
int ItemNum = 0;
double Tax = 0;
double NYTax = 8.78;
double SubTotal = 0;
double Total = 0;
double TotalFinal = 0;
//Printing menu options.
System.out.println(\"\ /*/*/*/*/*/*/*/*/ Mac King Fast Food /*/*/*/*/*/*/*/*/\");
System.out.println(\" \ Burgers:\" + \" \" + \"Side Orders: \");
System.out.println(\" 1. CheeseBurger $\" + df.format(((CheeseBurger) Menu[0]).cheeseBurger)
+ \" \" + \"5. Fries $\" + df.format(((Fries) Menu[4]).fries));
System.out.println(\" 2. ChickenBurger $\" + df.format(((ChickenBurger)
Menu[1]).chickenBurger) + \" \" + \"6. Onion Rings $\" + df.format(((OnionRings)
Menu[5]).onionRings));
System.out.println(\" \ Hot Dogs:\" + \" \" + \"Beverages: \");
System.out.println(\" 3. Super HotDog $\" + df.format(((SuperHotDog) Menu[2]).superHotDog)
+ \" \" + \"7. Soda $\" + df.format(((Soda) Menu[6]).soda));
System.out.println(\" 4. Mini HotDog $\" + df.format(((MiniHotDog) Menu[3]).miniHotDog) +
\" \" + \"8. Bottle of Water $\" + df.format(((BottleWater) Menu[7]).bottleWater));
//Loop to get order choice from user.
do {
if (Choice != 0)
{
System.out.print(\" !!Enter (0) to finish Order!!\ \");
}
System.out.print(\" \ Enter menu selection: \");
Choice = CashierInput.nextInt();
//Printing choices added.
//Counting items added.
//Counting number of items added.
//Calculating subtotal.
if (Choice == 1)
{
System.out.println(\"\ CheeseBurger added\");
SubTotal = ((CheeseBurger) Menu[0]).cheeseBurger;
Menu[0].addItem();
++CheeseBurger.cheeseBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 2)
{
System.out.println(\"\ ChickenBurger added\");
SubTotal = ((ChickenBurger) Menu[1]).chickenBurger;
Menu[1].addItem();
++ChickenBurger.chickenBCount;
++ItemNum;
Total = Total + SubTotal;
System.out.println(\"Current Subtotal $\" + (df.format(Total)));
}
else if (Choice == 3)
{
System.out.println(\"\ Super HotDog added\");
SubTotal = ((SuperHotDog) Menu[2]).superHotDog;
Menu[2].addItem();
++SuperHotDog.superHotDogCount;
++ItemN.
LUS (a) Prepare the jounal entry to recerd the proceeds of the note. .pdffcsondhiindia
LUS (a) Prepare the jounal entry to recerd the proceeds of the note. (b) Prepare the journal entry
to record accrued interest at December 31, assuming adjusting entries are made only at the end of
the y
Solution
Journal entry: Date Accounts title and explanations Debit $ Credit $ 1-Jul Cash
Account Dr. 45000 Notes payable 45000 31-Dec Interest expense Account Dr.
(45000*12%*6/12) 2700 Interest payable Account 2700.
JAVAneed help with public IteratorItem iterator()import java.u.pdffcsondhiindia
JAVA
need help with public Iterator iterator()
import java.util.Iterator;
/*
* GroupsQueue class supporting addition and removal of items
* with respect to a given number of priorities and with
* respect to the FIFO (first-in first-out) order for items
* with the same priority.
*
* An example, where GroupsQueue would be useful is the airline
* boarding process: every passenger gets assigned a priority,
* usually a number, e.g., group 1, group 2, group 3, etc. and
* the passengers line up at the end of the queue of their groups
* in a FIFO fashion; and, when removing from the GroupsQueue,
* i.e., when the passengers are boarding the plane, they get
* removed first by their group priorities and then by their FIFO
* ordering within that particular priority group.
*
* Your homework is to implement the below GroupsQueue data
* structure, so that it functions in the way described above.
*
* You may use the provided Queue class for implementing the
* GroupsQueue class.
*/
public class GroupsQueue implements Iterable {
private Node first;
private Node last;
private int n;
private static class Node {
private Item item;
private Node next;
}
public void Queue() {
first = null;
last = null;
n = 0;
}
// TODO : implement the data structure (20 points)
/**
* Initializes an empty GroupsQueue with g groups
* @return
*/
public GroupsQueue(int g) {
first = new Node<>();
last = first;
for(int i=1; i<=19; i++){
last.next = new Node<>();
last = last.next;
}
}
// TODO : implement the constructor (20 points)
/**
* Is this GroupsQueue empty?
*/
public boolean isEmpty() {
return size() == 0;
}
/**
* Returns the number of items in the GroupsQueue.
*/
public int size() {
return n; // TODO (20 points)
}
/**
* Adds the item to this GroupsQueue with group id = gId.
*/
public void add(Item item, int gId) {
Node oldlast = last;
last = new Node();
last.item = item;
last.next = null;
if (isEmpty()) first = last;
else{
oldlast.next = last;
}
n++;
}
// TODO (20 points)
/**
* Removes and returns the item with the lowest group id
*/
public Item remove() {
Node temp = first;
Node prev = first;
Item minGid;
if (! isEmpty())
{
minGid = first.item;
}
else
{
return null;
}
while(temp!= null)
{
prev = temp;
temp = temp.next;
if (temp.item == minGid)
{
minGid = (Item) temp.item;
}
}
if (minGid == first.item)
{
first = first.next;
}
else
{
prev.next = prev.next.next;
}
n--;
return minGid;
}// TODO (20 points)
/**
* Returns an iterator that iterates over the items in this GroupsQueue
* in group id order (lowest id first) and in FIFO order in each group.
*/
public Iterator iterator() {
// TODO
// BONUS (20 points)
return null;
}
}
Solution
Implementation given here seems to have many logical errors.
Here is the code given for GroupQueue:
package groupqueue;
public class GroupQueue{
/**
* n is number of queues maintained. and queues is array of all queues maintained by
GroupQueue.
* here there are n groups . so maintain n queues and each queue represent one group.
*/
public int n;
public Que.
Let A be an n n matrix. Which of the following are TRUE I. If A i.pdffcsondhiindia
Let A be an n n matrix. Which of the following are TRUE?
I. If A is diagonalizable, then A has n distinct eigenvalues.
II. If A is a matrix with all real entries, all eigenvalues are real.
III. If A is a real symmetric matrix, then it is diagonalizable.
A. I only
B. III only
C. I and II
D. I and III
E. None of the above
Solution
1st statement is false , if A is diagonalizable it may have repeated eigenvalues
statement 2 is false it may also have complex eigenvalues
only statement 3 is true a symmetric matrix is diagonalizable.
How does PERT technique compare with estimating or forecasting techn.pdffcsondhiindia
How does PERT technique compare with estimating or forecasting techniques you have used in
the past?
Solution
PERT:- It stands for Program Evaluation and Review Technique. It is an estimation method that
utilizes the weighted-average of three figures to establish an approximation of the tasks
necessary to complete in a project. In case of critical projects we need some methods that can
help us to successful completion of the project. PERT is a program network analysis method
which is used to plan and control large projects. Some of the activities that we are doing in PERT
which has not been done in past..
in 4 paragraphs explain Profit Sharing in the US between Management .pdffcsondhiindia
in 4 paragraphs explain Profit Sharing in the US between Management and Workers
Solution
ANSWER:
Profit sharing are numerous incentive plans introduced by businesses in United States that
provide direct or indirect payments to it\'s employees that depend on the profitability of business
in addition to regular salary and bonuses to the employees. The profit sharing bonus payments to
non-management employees specifically takes place at the discretion of the business and does
not constitute an entitlement. Business may use any number of different formulas for the
computation the distribution of profits to their employees and several variety of rules and
regulations regarding eligibility.
In United States few profit-sharing systems were established for precisely the purpose of
development of relationship between the management and workers. It is an approach for bringing
employees closer to management, thus boosting production and efficiency, building up employee
loyalty and avoiding union interference and industrial unrest. A profit sharing plan can be set up
in United States where all or few of the employee\'s profit sharing amount can be contributed to a
retirement plan. These are generally used in conjunction with 401(k) plans.
The advantage of profit sharing is that it spreads the message that all of the employees are
working together on the same team. Also the employees have the same targets and are provided
rewards equivalently to reinforce the shared service to customers and lack of competition among
each other.
The disadvantage of the profit sharing plans is that employees individually cannot see and know
the impact of their own actions and work on the company\'s profitability. Moreover after a while
employees enjoy receiving their profit sharing money, it often becomes more of an entitlement
instead of a motivational factor..
How is the urinary system is involved in regulating the pH in bodily.pdffcsondhiindia
How is the urinary system is involved in regulating the pH in bodily fluids?
Solution
Urinary system has two major roles in the pH balance.
1. kidney excrete H+ ion from the body into the urine
2. kidney also accumulate HCO3- into the blood which works as a buffering agent for the blood.
This bicarbonate ions reabsorbance is done in Tubular fluid with the help of tubular cells.
So by this way of maintaining the balance of acid and base together urinary system regulates the
pH of body..
Find a polynomial that describes the shaded area. SolutionArea.pdffcsondhiindia
Find a polynomial that describes the shaded area.
Solution
Area of shades region = area of big rectangle - area of small rectangle.
Area of rectangle = Lenght x Breadth
Area of small rectangle = xy
Area of big rectangle = 2x(2y+1) = 4xy +2x
So polynomial describing shaded region is :
4xy +2x - xy = 3xy +2x..
Explain the common interest logic and the economic logic of .pdffcsondhiindia
Explain the \"common interest logic\" and the \"economic logic\" of group behavior in term of
the likelihood of the success of groups.
How does the idea of a \"tough boss\" and a \"residual claimant\" reduce the problem of the
inefficiency of large groups trying to get things done?
Solution
According to \"Common Interest Logic\" of group behaviour, it begin by recognizing the
multiplicity of forces which affect group members. This theory views the \'group\' as an organic
whole, like an individual, as opposed to collection of individuals whose separate actions appear
to be group action. As per this theory, the group has its life of its own that is to a degree
independent of the individuals who comprise it. Under \"Common Interest Logic\", two major
reasons are given for viewing group as social individuals. First, a group consists of a mass of
interdependencies ,which connect the individuals in the group. Second, group tends to emerge
because they satisfy some interest shared by all the group\'s members.
Under Economic Logic of group behaviour, people are assumed to be rational in their decision to
join a grop as they are toward doing anything else. They will join a group if the benefits of doing
so are greater than the costs they must bear. These cost and benefits like all others relevant to any
other act. must be discounted by the going interest on borrowed funds to account for any time
delay in the incurrence of the costs and the benefits and by the probability that the costs and the
benefits will berealized..
Does privacy always guarantee integrity. Justify your answerSolu.pdffcsondhiindia
Does privacy always guarantee integrity. Justify your answer
Solution
Privacy always guarantee utmost like money, time for an organisations ensuring that an
organisations that no information is ommitted because of hackers so to happen this many privacy
polices are to be considered within then like authentication. Integrity is the control of methods
and assets from undisclosed changes. Privacy controls combine with subjugation, confidentiality,
and authentication controls helps not to track or hack the information. These operation by those
hackers will commit this to make the organisations to loose their integrity. So privacy is much
needed so it always guarntee integrity..
Distinguish between the GAAP and IFRS standards for internal .pdffcsondhiindia
Distinguish between the GAAP and IFRS standards for internal control.
Distinguish between the GAAP and IFRS standards for internal control.
Distinguish between the GAAP and IFRS standards for internal control.
Distinguish between the GAAP and IFRS standards for internal control.
Solution
Diffenece Between GAAP and IFRS standards for internal control.
- GAAP stands for Generally accepted accounting principles. IFRS stands for International
Financial reporting standards.
- IFRS are globally accepted accounting standards which is used by many countries for the
preperation of financial statements.GAAP are the set of accounting principles which are used
only in United States for the preperation of financial statements
- GAAP are formed by Financial Accounting Standard Board. However, IFRS are developed by
International accounting standard board.
- If we talk about Inventory method, GAAP uses FIFO, LIFO and weighted average method,
However IFRS uses FIFO and weighted average method.
- Under IFRS, etraordinary items are not segregated in the income statement, while under
GAAP, extraordinary items are shown under the net income.
-GAAP are rule based, and IFRS are principle based.
-GAAP prohibits the reversal of inventory. But it is permissable under IFRS only when some
specific conditions satisfy..
Describe how pH inhibit microbe growth.SolutionMost of the pat.pdffcsondhiindia
Describe how pH inhibit microbe growth.
Solution
Most of the pathogenic microbes requires a normal pH for its growth and survival and they are
known as neutrophiles. A too high or low pH can inhibit microbial growth either by disrupting
its cell membrane or by inactivating the enzymes required for growth and maintenance of the
microbes..
Write the C code to create a data structure named window that con.pdffcsondhiindia
Write the C code to create a data structure named \"window\" that contains the data elements
\"width\", \"height\", \"name\", and \"color\". Select the appropriate data types for each data
element.
Solution
struct window{
float width;
float height;
char name[20];
char color[20];
};
void main()
{
struct database shape;
shape.width = 50.0;
shape.height = 60.0;
shape.name = \"John\";
shape.color = \"red\";
}.
Write 4 to 5 paragraphs aboutthe Dyn cyber attack that occurred in.pdffcsondhiindia
Write 4 to 5 paragraphs about
the Dyn cyber attack that occurred in 2016.
1-What techniques were used to launch the attack?
2- Who was the victim?
3-What was the vulnerability in the victim that led to the success of this attack?
4-What are some of the remedial measures, if any, that have been taken after the attack?
Solution
Dyn Cyber Attack occurred on October 21, 2016. It was a series of distributed denial-of-service
(DDoS) attacks against Dyn DNS impacted the availability of a number of sites concentrated in
the Northeast US and, later, other areas of the country using maliciously targeted, masked TCP
and UDP traffic over port 53.The attacks struck Twitter, Paypal, Spotify and other customers of
an infrastructure company in New Hampshire called Dyn, which acts as a switchboard for
internet traffic.
\"Internet Of Things (IOT)\" techniques were used to launch the attack. One of the sources of the
attack is coming from devices known as the \"Internet of Things\" devices such as DVRs,
Printers, and appliances connected to the internet.
One portion of the attack was initiated by a Mirai Command and Control server. Mirai botnets
were previously used in the DDoS attacks earlier against the “Krebs on Security” blog and the
French internet service and hosting provider OVH. Mirai is one of two malware families that are
being used to get armies of zombies together and perform attacks on targets.
The botnet behind the Krebs attack used a particular malware code, known as Mirai, which scans
the internet looking for vulnerable IoT devices that have default settings. As in, you haven\'t
changed your username and password from admin. Attackers wrote a small piece of code,
deployed it and now all these internets of things devices, which most people just set up and
forget about, are actively participating in a DDoS attack. Criminals have used these attacks as a
means of extortion. These attack techniques are broadly available. Fully capable DDoS attack
tools are available for free download. Criminal groups offer DDoS services for hire. These
vulnerabilities in the victim that led to the success of this attack.
After the attack, observations of the TCP attack volume from a few of our data centers indicate
packet flow bursts 40 to 50 times higher than normal. This magnitude does not take into account
a significant portion of traffic that never reached Dyn due to our own mitigation efforts as well
as the mitigation of upstream providers..
Who are the people directly involved in the collective bargaining pr.pdffcsondhiindia
Who are the people directly involved in the collective bargaining process? What are their roles?
What is the purpose of a management right clause? Do you agree with the reserved rights theory,
why or why not?
Discuss how negotiators prepare for negotiations.
Why have the number of major economic strikes in the United States declined?
What is the purpose of a union picket line? Why are they less successful today than in past
years?
Solution
A) The representatives of Union and Management are the one who is responsible for
negotiations. Members of the Union and the staff are the one who is majorly responsible for
negotiations. CEOs and Presidents are the ones who give the negotiating rights to these members
and staffs of Procurement team. These members are basically the ex-president of Union or
someone who was earlier at a very responsible position in the organization.
B) The purpose of the management is to take care of the following things:
These theory are very important for the smooth functioning of the organization otherwise the
different external forces will create problems within the organization and may violate the output.
C) The most ordinarily neglected part of negotiation is preparation. There is not any more
beneficial use of time than the time spent getting ready to arrange. There are a few stages to take
in this procedure.
In the first place, recognize what you need and don\'t need. The vast majority have a general
thought of what things they need or don\'t need in an arrangement. Unfortunately, general
objectives tend to render general outcomes ... prompting second-speculating and disappointment.
Second, recognize what your counterpart needs and doesn\'t need. Compose a point by point
depiction of what the other party is searching for and trying to keep away from. This activity has
a tendency to be a genuine stumper, inevitably a genuine eye-opener. Knowing a partner\'s
objectives, sought-after outcomes uncover shared traits that prompt innovative solution.
Third, distinguish conceivable concessions. This implies comprehending what is totally
important to accomplish in consummating a fruitful deal, and what terms, conditions and
additional items could be prohibited.
Next, know the options. It is diligent work to truly examine every one of the choices. In
consulting for a raw material purchase or an agreement benefit, there are a few inquiries to begin
with. What could different providers offer the same or comparative items or services? Might you
be able to deliver the thing yourself? Is creating this item the best utilization of your assets?
Would you be able to converse with another person at a similar organization if the association
with the present rep isn\'t working?
In looking at options, make sure to utilize similar inquiries and destinations to guarantee
exactness in the examination. Talking a similar language with respect to the potential outcomes
will uncover the qualities and differentiation among the options.
Next, know .
Contracts or agreements can sometimes create financial contingencies.pdffcsondhiindia
Contracts or agreements can sometimes create financial contingencies for companies. Discuss
what types of contractual obligations must be disclosed in great detail in the notes to the balance
sheet and why you think these details should be disclosed.
Solution
The following four items should be disclosed mandatorily in the notes to balance sheet in great
detail :
1.General debt obligations
2.lease contracts
3.pension arrangements and
4.stock option plans.
The reason for disclosing these contractual situations is that these commitments are of ;
1.long-term nature
2.Are often significant in amount and
3.Are very important to the company\'s well-being..
Which of the following is an equation of the line that passes through.pdffcsondhiindia
Which of the following is an equation of the line that passes through the points (-2, 1) and (1, 2)
in the xy-plane? x + 3y = 1 x + 3y = 5 x + 3y = -5 x - 3y = -5 x - 3y = -1
Solution
given points (-2,1) and (1,2)
slope = [2-1]/[1-(-2)] = 1/3
from given options D and E has only slope 1/3 ,hence D and E are passing trough the points
ans: D,E.
When more than one structural arrangement of elements is possible fo.pdffcsondhiindia
When more than one structural arrangement of elements is possible for a single chemical
formula, what is the general technical term used to refer to the different structural forms?
Solution
isomersÂ
In , isomers  are compounds with the same molecular formula but differentÂ
structural formulaIsomers do not necessarily share similar properties, unless they also have the
same functional groups There are many different classes of isomers, like stereoisomers,
enantiomers, geometrical isomers, There are two main forms of isomerism:Â structural
isomersim and stereoisomerism.
Click to add title 2. Explain the concept of African Diaspora and dis.pdffcsondhiindia
Click to add title 2. Explain the concept of African Diaspora and distinguish between voluntary
and involuntary African Diaspora. Identify and explain the five stages in the evolution of the
African Diaspora, and show the nature, dynamics and complexity of the African Diaspora
experience
Solution
The concept of Diaspora: This phenomenon explains dispersed population scattered from their
specific homelands but they maintain their cultural aspects in the country where they migrated.
Diaspora is going to illustrate about the people themselves or their previous ancestors & the
people who have been living are going to retain their cultural aspects with “memories/myths”
about their specific homeland. The voluntary migration of population from their homeland where
they are not forced to migrate known as “voluntary Diaspora” where, “you will find no force to
migrate”. The involuntary migration of population from their homeland where they are forced to
migrate known as “involuntary Diaspora (refugees migrate)” where, “you will find force to
migrate” (mainly religious persecutions).
According to Wilbur Zelinsky, the dynamics of Diaspora is mainly due to immigrants &
emigrants and the extent to which Diaspora is a global phenomenon is explained mainly by rural
and urban migration. These dynamics can be explained by data that collected & correlates to
extent of migration rates specifically within a country over a period..
ATP production during glycolysis;requires an enzymeoccurs in the.pdffcsondhiindia
ATP production during glycolysis;
requires an enzyme
occurs in the cytosol
occurs via substrate-level phosphorylation
all of the above
The reactions of the Krebs cycle occur in the:
Inner membrane of the mitochondria
Intermembrane space of the mitochondria
The cycoplasm
The matrix of the mitochondria
The movement of electrons down the electron transport chain
Is used to make acetyl-CoA
Generates CO2
Produces an electron gradient
Pumps protons into the intermembrane space
Which of the following accurately describes a distinction between lactic acid fermentation and
alcoholic (ethanol) fermentation?
Lactic acid fermentation occurs in prokaryotes, whereas alcoholic (ethanol) fermentation occurs
in eukaryotes
The final electron acceptor in lactic acid fermentation is pyruvate; the final electron acceptor in
alcoholic (ethanol) fermentation is acetaldehyde
In lactic acid fermentation, NADH is produced by glycolysis; in alcoholic (ethanol)
fermentation, NADH is produced by the Krebs cycle
In lactic acid fermentation, cell use CO2 in place of oxygen; in alcoholic (ethanol) fermentation,
cells use SO4
Which pathway is see in both fermentation and aerobic respiration?
Krebs cycle
Electron transport
Glycolysis
Pyruvate oxidation
Solution
(1) all of the above
(2)The matrix of the mitochondria
(3) Pumps protons into the intermembrane space
(4) The final electron acceptor in lactic acid fermentation is pyruvate; the final electron acceptor
in alcoholic (ethanol) fermentation is acetaldehyde
(5) Glycolysis.
What are symptoms of N, P, K, Mg, S and Fe deficiencies in plants.pdffcsondhiindia
What are symptoms of N, P, K, Mg, S and Fe deficiencies in plants
Solution
Mg,P, S, Fe, N, K are essential plant minerals performing several function so any deficiency in
these minerals cause several deficiency symptoms in plants.
NITROGEN- leaves are small light green , lower leaf is lighter then upper leaf, weak leaf stalk.
PHOSPHOROUS- dark green foliage,lower leaves sometimes yellow between vein, purplish
colour on leaves.
potassium K- LOWER LEAF MOTTLES, DEAD AREA NEAR TIP AND MERGIN OF
LEAVES.
magnesium Mg- leaf mergin may curl up and down, lower leaf is yellow between vein, leaf may
die later.
SUIFUR S- tip of shoot stay alive, leaf vein lighter than surrounding areas,
Fe- new upper leaf turns yellow between veins, edge and tip of leaf may die..
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
JAVAneed help with public IteratorItem iterator()import java.u.pdffcsondhiindia
JAVA
need help with public Iterator iterator()
import java.util.Iterator;
/*
* GroupsQueue class supporting addition and removal of items
* with respect to a given number of priorities and with
* respect to the FIFO (first-in first-out) order for items
* with the same priority.
*
* An example, where GroupsQueue would be useful is the airline
* boarding process: every passenger gets assigned a priority,
* usually a number, e.g., group 1, group 2, group 3, etc. and
* the passengers line up at the end of the queue of their groups
* in a FIFO fashion; and, when removing from the GroupsQueue,
* i.e., when the passengers are boarding the plane, they get
* removed first by their group priorities and then by their FIFO
* ordering within that particular priority group.
*
* Your homework is to implement the below GroupsQueue data
* structure, so that it functions in the way described above.
*
* You may use the provided Queue class for implementing the
* GroupsQueue class.
*/
public class GroupsQueue implements Iterable {
private Node first;
private Node last;
private int n;
private static class Node {
private Item item;
private Node next;
}
public void Queue() {
first = null;
last = null;
n = 0;
}
// TODO : implement the data structure (20 points)
/**
* Initializes an empty GroupsQueue with g groups
* @return
*/
public GroupsQueue(int g) {
first = new Node<>();
last = first;
for(int i=1; i<=19; i++){
last.next = new Node<>();
last = last.next;
}
}
// TODO : implement the constructor (20 points)
/**
* Is this GroupsQueue empty?
*/
public boolean isEmpty() {
return size() == 0;
}
/**
* Returns the number of items in the GroupsQueue.
*/
public int size() {
return n; // TODO (20 points)
}
/**
* Adds the item to this GroupsQueue with group id = gId.
*/
public void add(Item item, int gId) {
Node oldlast = last;
last = new Node();
last.item = item;
last.next = null;
if (isEmpty()) first = last;
else{
oldlast.next = last;
}
n++;
}
// TODO (20 points)
/**
* Removes and returns the item with the lowest group id
*/
public Item remove() {
Node temp = first;
Node prev = first;
Item minGid;
if (! isEmpty())
{
minGid = first.item;
}
else
{
return null;
}
while(temp!= null)
{
prev = temp;
temp = temp.next;
if (temp.item == minGid)
{
minGid = (Item) temp.item;
}
}
if (minGid == first.item)
{
first = first.next;
}
else
{
prev.next = prev.next.next;
}
n--;
return minGid;
}// TODO (20 points)
/**
* Returns an iterator that iterates over the items in this GroupsQueue
* in group id order (lowest id first) and in FIFO order in each group.
*/
public Iterator iterator() {
// TODO
// BONUS (20 points)
return null;
}
}
Solution
Implementation given here seems to have many logical errors.
Here is the code given for GroupQueue:
package groupqueue;
public class GroupQueue{
/**
* n is number of queues maintained. and queues is array of all queues maintained by
GroupQueue.
* here there are n groups . so maintain n queues and each queue represent one group.
*/
public int n;
public Que.
Let A be an n n matrix. Which of the following are TRUE I. If A i.pdffcsondhiindia
Let A be an n n matrix. Which of the following are TRUE?
I. If A is diagonalizable, then A has n distinct eigenvalues.
II. If A is a matrix with all real entries, all eigenvalues are real.
III. If A is a real symmetric matrix, then it is diagonalizable.
A. I only
B. III only
C. I and II
D. I and III
E. None of the above
Solution
1st statement is false , if A is diagonalizable it may have repeated eigenvalues
statement 2 is false it may also have complex eigenvalues
only statement 3 is true a symmetric matrix is diagonalizable.
How does PERT technique compare with estimating or forecasting techn.pdffcsondhiindia
How does PERT technique compare with estimating or forecasting techniques you have used in
the past?
Solution
PERT:- It stands for Program Evaluation and Review Technique. It is an estimation method that
utilizes the weighted-average of three figures to establish an approximation of the tasks
necessary to complete in a project. In case of critical projects we need some methods that can
help us to successful completion of the project. PERT is a program network analysis method
which is used to plan and control large projects. Some of the activities that we are doing in PERT
which has not been done in past..
in 4 paragraphs explain Profit Sharing in the US between Management .pdffcsondhiindia
in 4 paragraphs explain Profit Sharing in the US between Management and Workers
Solution
ANSWER:
Profit sharing are numerous incentive plans introduced by businesses in United States that
provide direct or indirect payments to it\'s employees that depend on the profitability of business
in addition to regular salary and bonuses to the employees. The profit sharing bonus payments to
non-management employees specifically takes place at the discretion of the business and does
not constitute an entitlement. Business may use any number of different formulas for the
computation the distribution of profits to their employees and several variety of rules and
regulations regarding eligibility.
In United States few profit-sharing systems were established for precisely the purpose of
development of relationship between the management and workers. It is an approach for bringing
employees closer to management, thus boosting production and efficiency, building up employee
loyalty and avoiding union interference and industrial unrest. A profit sharing plan can be set up
in United States where all or few of the employee\'s profit sharing amount can be contributed to a
retirement plan. These are generally used in conjunction with 401(k) plans.
The advantage of profit sharing is that it spreads the message that all of the employees are
working together on the same team. Also the employees have the same targets and are provided
rewards equivalently to reinforce the shared service to customers and lack of competition among
each other.
The disadvantage of the profit sharing plans is that employees individually cannot see and know
the impact of their own actions and work on the company\'s profitability. Moreover after a while
employees enjoy receiving their profit sharing money, it often becomes more of an entitlement
instead of a motivational factor..
How is the urinary system is involved in regulating the pH in bodily.pdffcsondhiindia
How is the urinary system is involved in regulating the pH in bodily fluids?
Solution
Urinary system has two major roles in the pH balance.
1. kidney excrete H+ ion from the body into the urine
2. kidney also accumulate HCO3- into the blood which works as a buffering agent for the blood.
This bicarbonate ions reabsorbance is done in Tubular fluid with the help of tubular cells.
So by this way of maintaining the balance of acid and base together urinary system regulates the
pH of body..
Find a polynomial that describes the shaded area. SolutionArea.pdffcsondhiindia
Find a polynomial that describes the shaded area.
Solution
Area of shades region = area of big rectangle - area of small rectangle.
Area of rectangle = Lenght x Breadth
Area of small rectangle = xy
Area of big rectangle = 2x(2y+1) = 4xy +2x
So polynomial describing shaded region is :
4xy +2x - xy = 3xy +2x..
Explain the common interest logic and the economic logic of .pdffcsondhiindia
Explain the \"common interest logic\" and the \"economic logic\" of group behavior in term of
the likelihood of the success of groups.
How does the idea of a \"tough boss\" and a \"residual claimant\" reduce the problem of the
inefficiency of large groups trying to get things done?
Solution
According to \"Common Interest Logic\" of group behaviour, it begin by recognizing the
multiplicity of forces which affect group members. This theory views the \'group\' as an organic
whole, like an individual, as opposed to collection of individuals whose separate actions appear
to be group action. As per this theory, the group has its life of its own that is to a degree
independent of the individuals who comprise it. Under \"Common Interest Logic\", two major
reasons are given for viewing group as social individuals. First, a group consists of a mass of
interdependencies ,which connect the individuals in the group. Second, group tends to emerge
because they satisfy some interest shared by all the group\'s members.
Under Economic Logic of group behaviour, people are assumed to be rational in their decision to
join a grop as they are toward doing anything else. They will join a group if the benefits of doing
so are greater than the costs they must bear. These cost and benefits like all others relevant to any
other act. must be discounted by the going interest on borrowed funds to account for any time
delay in the incurrence of the costs and the benefits and by the probability that the costs and the
benefits will berealized..
Does privacy always guarantee integrity. Justify your answerSolu.pdffcsondhiindia
Does privacy always guarantee integrity. Justify your answer
Solution
Privacy always guarantee utmost like money, time for an organisations ensuring that an
organisations that no information is ommitted because of hackers so to happen this many privacy
polices are to be considered within then like authentication. Integrity is the control of methods
and assets from undisclosed changes. Privacy controls combine with subjugation, confidentiality,
and authentication controls helps not to track or hack the information. These operation by those
hackers will commit this to make the organisations to loose their integrity. So privacy is much
needed so it always guarntee integrity..
Distinguish between the GAAP and IFRS standards for internal .pdffcsondhiindia
Distinguish between the GAAP and IFRS standards for internal control.
Distinguish between the GAAP and IFRS standards for internal control.
Distinguish between the GAAP and IFRS standards for internal control.
Distinguish between the GAAP and IFRS standards for internal control.
Solution
Diffenece Between GAAP and IFRS standards for internal control.
- GAAP stands for Generally accepted accounting principles. IFRS stands for International
Financial reporting standards.
- IFRS are globally accepted accounting standards which is used by many countries for the
preperation of financial statements.GAAP are the set of accounting principles which are used
only in United States for the preperation of financial statements
- GAAP are formed by Financial Accounting Standard Board. However, IFRS are developed by
International accounting standard board.
- If we talk about Inventory method, GAAP uses FIFO, LIFO and weighted average method,
However IFRS uses FIFO and weighted average method.
- Under IFRS, etraordinary items are not segregated in the income statement, while under
GAAP, extraordinary items are shown under the net income.
-GAAP are rule based, and IFRS are principle based.
-GAAP prohibits the reversal of inventory. But it is permissable under IFRS only when some
specific conditions satisfy..
Describe how pH inhibit microbe growth.SolutionMost of the pat.pdffcsondhiindia
Describe how pH inhibit microbe growth.
Solution
Most of the pathogenic microbes requires a normal pH for its growth and survival and they are
known as neutrophiles. A too high or low pH can inhibit microbial growth either by disrupting
its cell membrane or by inactivating the enzymes required for growth and maintenance of the
microbes..
Write the C code to create a data structure named window that con.pdffcsondhiindia
Write the C code to create a data structure named \"window\" that contains the data elements
\"width\", \"height\", \"name\", and \"color\". Select the appropriate data types for each data
element.
Solution
struct window{
float width;
float height;
char name[20];
char color[20];
};
void main()
{
struct database shape;
shape.width = 50.0;
shape.height = 60.0;
shape.name = \"John\";
shape.color = \"red\";
}.
Write 4 to 5 paragraphs aboutthe Dyn cyber attack that occurred in.pdffcsondhiindia
Write 4 to 5 paragraphs about
the Dyn cyber attack that occurred in 2016.
1-What techniques were used to launch the attack?
2- Who was the victim?
3-What was the vulnerability in the victim that led to the success of this attack?
4-What are some of the remedial measures, if any, that have been taken after the attack?
Solution
Dyn Cyber Attack occurred on October 21, 2016. It was a series of distributed denial-of-service
(DDoS) attacks against Dyn DNS impacted the availability of a number of sites concentrated in
the Northeast US and, later, other areas of the country using maliciously targeted, masked TCP
and UDP traffic over port 53.The attacks struck Twitter, Paypal, Spotify and other customers of
an infrastructure company in New Hampshire called Dyn, which acts as a switchboard for
internet traffic.
\"Internet Of Things (IOT)\" techniques were used to launch the attack. One of the sources of the
attack is coming from devices known as the \"Internet of Things\" devices such as DVRs,
Printers, and appliances connected to the internet.
One portion of the attack was initiated by a Mirai Command and Control server. Mirai botnets
were previously used in the DDoS attacks earlier against the “Krebs on Security” blog and the
French internet service and hosting provider OVH. Mirai is one of two malware families that are
being used to get armies of zombies together and perform attacks on targets.
The botnet behind the Krebs attack used a particular malware code, known as Mirai, which scans
the internet looking for vulnerable IoT devices that have default settings. As in, you haven\'t
changed your username and password from admin. Attackers wrote a small piece of code,
deployed it and now all these internets of things devices, which most people just set up and
forget about, are actively participating in a DDoS attack. Criminals have used these attacks as a
means of extortion. These attack techniques are broadly available. Fully capable DDoS attack
tools are available for free download. Criminal groups offer DDoS services for hire. These
vulnerabilities in the victim that led to the success of this attack.
After the attack, observations of the TCP attack volume from a few of our data centers indicate
packet flow bursts 40 to 50 times higher than normal. This magnitude does not take into account
a significant portion of traffic that never reached Dyn due to our own mitigation efforts as well
as the mitigation of upstream providers..
Who are the people directly involved in the collective bargaining pr.pdffcsondhiindia
Who are the people directly involved in the collective bargaining process? What are their roles?
What is the purpose of a management right clause? Do you agree with the reserved rights theory,
why or why not?
Discuss how negotiators prepare for negotiations.
Why have the number of major economic strikes in the United States declined?
What is the purpose of a union picket line? Why are they less successful today than in past
years?
Solution
A) The representatives of Union and Management are the one who is responsible for
negotiations. Members of the Union and the staff are the one who is majorly responsible for
negotiations. CEOs and Presidents are the ones who give the negotiating rights to these members
and staffs of Procurement team. These members are basically the ex-president of Union or
someone who was earlier at a very responsible position in the organization.
B) The purpose of the management is to take care of the following things:
These theory are very important for the smooth functioning of the organization otherwise the
different external forces will create problems within the organization and may violate the output.
C) The most ordinarily neglected part of negotiation is preparation. There is not any more
beneficial use of time than the time spent getting ready to arrange. There are a few stages to take
in this procedure.
In the first place, recognize what you need and don\'t need. The vast majority have a general
thought of what things they need or don\'t need in an arrangement. Unfortunately, general
objectives tend to render general outcomes ... prompting second-speculating and disappointment.
Second, recognize what your counterpart needs and doesn\'t need. Compose a point by point
depiction of what the other party is searching for and trying to keep away from. This activity has
a tendency to be a genuine stumper, inevitably a genuine eye-opener. Knowing a partner\'s
objectives, sought-after outcomes uncover shared traits that prompt innovative solution.
Third, distinguish conceivable concessions. This implies comprehending what is totally
important to accomplish in consummating a fruitful deal, and what terms, conditions and
additional items could be prohibited.
Next, know the options. It is diligent work to truly examine every one of the choices. In
consulting for a raw material purchase or an agreement benefit, there are a few inquiries to begin
with. What could different providers offer the same or comparative items or services? Might you
be able to deliver the thing yourself? Is creating this item the best utilization of your assets?
Would you be able to converse with another person at a similar organization if the association
with the present rep isn\'t working?
In looking at options, make sure to utilize similar inquiries and destinations to guarantee
exactness in the examination. Talking a similar language with respect to the potential outcomes
will uncover the qualities and differentiation among the options.
Next, know .
Contracts or agreements can sometimes create financial contingencies.pdffcsondhiindia
Contracts or agreements can sometimes create financial contingencies for companies. Discuss
what types of contractual obligations must be disclosed in great detail in the notes to the balance
sheet and why you think these details should be disclosed.
Solution
The following four items should be disclosed mandatorily in the notes to balance sheet in great
detail :
1.General debt obligations
2.lease contracts
3.pension arrangements and
4.stock option plans.
The reason for disclosing these contractual situations is that these commitments are of ;
1.long-term nature
2.Are often significant in amount and
3.Are very important to the company\'s well-being..
Which of the following is an equation of the line that passes through.pdffcsondhiindia
Which of the following is an equation of the line that passes through the points (-2, 1) and (1, 2)
in the xy-plane? x + 3y = 1 x + 3y = 5 x + 3y = -5 x - 3y = -5 x - 3y = -1
Solution
given points (-2,1) and (1,2)
slope = [2-1]/[1-(-2)] = 1/3
from given options D and E has only slope 1/3 ,hence D and E are passing trough the points
ans: D,E.
When more than one structural arrangement of elements is possible fo.pdffcsondhiindia
When more than one structural arrangement of elements is possible for a single chemical
formula, what is the general technical term used to refer to the different structural forms?
Solution
isomersÂ
In , isomers  are compounds with the same molecular formula but differentÂ
structural formulaIsomers do not necessarily share similar properties, unless they also have the
same functional groups There are many different classes of isomers, like stereoisomers,
enantiomers, geometrical isomers, There are two main forms of isomerism:Â structural
isomersim and stereoisomerism.
Click to add title 2. Explain the concept of African Diaspora and dis.pdffcsondhiindia
Click to add title 2. Explain the concept of African Diaspora and distinguish between voluntary
and involuntary African Diaspora. Identify and explain the five stages in the evolution of the
African Diaspora, and show the nature, dynamics and complexity of the African Diaspora
experience
Solution
The concept of Diaspora: This phenomenon explains dispersed population scattered from their
specific homelands but they maintain their cultural aspects in the country where they migrated.
Diaspora is going to illustrate about the people themselves or their previous ancestors & the
people who have been living are going to retain their cultural aspects with “memories/myths”
about their specific homeland. The voluntary migration of population from their homeland where
they are not forced to migrate known as “voluntary Diaspora” where, “you will find no force to
migrate”. The involuntary migration of population from their homeland where they are forced to
migrate known as “involuntary Diaspora (refugees migrate)” where, “you will find force to
migrate” (mainly religious persecutions).
According to Wilbur Zelinsky, the dynamics of Diaspora is mainly due to immigrants &
emigrants and the extent to which Diaspora is a global phenomenon is explained mainly by rural
and urban migration. These dynamics can be explained by data that collected & correlates to
extent of migration rates specifically within a country over a period..
ATP production during glycolysis;requires an enzymeoccurs in the.pdffcsondhiindia
ATP production during glycolysis;
requires an enzyme
occurs in the cytosol
occurs via substrate-level phosphorylation
all of the above
The reactions of the Krebs cycle occur in the:
Inner membrane of the mitochondria
Intermembrane space of the mitochondria
The cycoplasm
The matrix of the mitochondria
The movement of electrons down the electron transport chain
Is used to make acetyl-CoA
Generates CO2
Produces an electron gradient
Pumps protons into the intermembrane space
Which of the following accurately describes a distinction between lactic acid fermentation and
alcoholic (ethanol) fermentation?
Lactic acid fermentation occurs in prokaryotes, whereas alcoholic (ethanol) fermentation occurs
in eukaryotes
The final electron acceptor in lactic acid fermentation is pyruvate; the final electron acceptor in
alcoholic (ethanol) fermentation is acetaldehyde
In lactic acid fermentation, NADH is produced by glycolysis; in alcoholic (ethanol)
fermentation, NADH is produced by the Krebs cycle
In lactic acid fermentation, cell use CO2 in place of oxygen; in alcoholic (ethanol) fermentation,
cells use SO4
Which pathway is see in both fermentation and aerobic respiration?
Krebs cycle
Electron transport
Glycolysis
Pyruvate oxidation
Solution
(1) all of the above
(2)The matrix of the mitochondria
(3) Pumps protons into the intermembrane space
(4) The final electron acceptor in lactic acid fermentation is pyruvate; the final electron acceptor
in alcoholic (ethanol) fermentation is acetaldehyde
(5) Glycolysis.
What are symptoms of N, P, K, Mg, S and Fe deficiencies in plants.pdffcsondhiindia
What are symptoms of N, P, K, Mg, S and Fe deficiencies in plants
Solution
Mg,P, S, Fe, N, K are essential plant minerals performing several function so any deficiency in
these minerals cause several deficiency symptoms in plants.
NITROGEN- leaves are small light green , lower leaf is lighter then upper leaf, weak leaf stalk.
PHOSPHOROUS- dark green foliage,lower leaves sometimes yellow between vein, purplish
colour on leaves.
potassium K- LOWER LEAF MOTTLES, DEAD AREA NEAR TIP AND MERGIN OF
LEAVES.
magnesium Mg- leaf mergin may curl up and down, lower leaf is yellow between vein, leaf may
die later.
SUIFUR S- tip of shoot stay alive, leaf vein lighter than surrounding areas,
Fe- new upper leaf turns yellow between veins, edge and tip of leaf may die..
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
I have the source code for three separate java programs (TestVending.pdf
1. I have the source code for three separate java programs (TestVendingMachine.java,
VendingMachineException.java, and VendingMachine.java), which work together to recreate the
sample output provided. All three programs compile and work as they should but I need to make
a minor adjustment to the VendingMachine.java program and would appreciate any help. When
the user input returns any of the three possible errors (out of stock, insufficent funds, and invalid
item), the program should automatically move onto the next user input prompt without
displaying the dispensing options and change returned.
VendingMachine.java
import java.util.Random;
import java.util.regex.*;
public class VendingMachine
{
// soft drinks candy bars snacks
private String[][] items = { {"Pepsi", "Snickers", "Potato Chips"},
{"Diet Pepsi", "Resse's Cup", "Ruffles"},
{"Dr. Pepper", "M&M chocolate","Fritos"},
{"Diet Dr. P", "Peanut M&Ms", "Doritos"},
{"Sprite", "Twisters", "Almonds"},
{"Diet Sprite", "Hershey's", "Peanuts"} };
private int[][] prices = { {75,65,30},
{80,60,35},
{70,55,40},
{75,60,45},
{60,45,50},
{65,40,35} };
private int[][] quantity = { {3,1,0},
{4,6,5},
{7,5,4},
{5,0,5},
{0,4,0},
{6,4,3} };
private int depositedAmt = 0;
private boolean haveValidSelection = false;
private int selectedRow = 0;
private char selectedCol = 'A';
3. change = getChange();
}
else
System.out.print(String.format("*** Error: Vending Machine - Insufficient funds for
item: %s%nCost: $0.%d, Deposited: $%.2f",
items[selectedRow][col], prices[selectedRow][col],
getDeposit()/100.0));
else
System.out.print(String.format("*** Error: Vending Machine - Out of stock on this
item: %s%nCost: $0.%d",
items[selectedRow][col], prices[selectedRow][col]));
}
else
System.out.print("*** Error: Vending Machine - Invalid item selection: "+selection);
}
else
System.out.print("Please enter proper funds before making selection: "+selection);
return change;
}
public void depositMoney(int payment)
{
if(payment > 0)
depositedAmt += payment;
}
public int getChange()
{
int returned = depositedAmt;
depositedAmt = 0;
return returned;
}
public int getDeposit()
{
return depositedAmt;
}
// returns String representation of object
public String toString()
4. {
// display items, quantity on hand, and prices
StringBuffer display = new StringBuffer();
// holds display contents
display.append(" Price A (in stock) Price B (in stock) Price C (in stock) ");
display.append("1 $0."+prices[0][0]+" Pepsi("+quantity[0][0]+") $0."
+prices[0][1] +" Snickers("+quantity[0][1]
+") $0."+prices[0][2]+" Potato Chips("+quantity[0][2]+") ");
display.append("2 $0."+prices[1][0]+" Diet Pepsi("+quantity[1][0]
+") $0."+prices[1][1]+" Resse's Cup("+quantity[1][1]
+") $0."+prices[1][2]+" Ruffles("+quantity[1][2]+") ");
display.append("3 $0."+prices[2][0]+" Dr. Pepper("+quantity[2][0]
+") $0."+prices[2][1]+" M&Ms (reg)("+quantity[2][1]
+") $0."+prices[2][2]+" Fritos("+quantity[2][2]+") ");
display.append("4 $0."+prices[3][0]+" Diet Dr. P("+quantity[3][0]
+") $0."+prices[3][1]+" Peanut M&Ms("+quantity[3][1]
+") $0."+prices[3][2]+" Doritos("+quantity[3][2]+") ");
display.append("5 $0."+prices[4][0]+" Sprite("+quantity[4][0]
+") $0."+prices[4][1]+" Twisters("+quantity[4][1]
+") $0."+prices[4][2]+" Almonds("+quantity[4][2]+") ");
display.append("6 $0."+prices[5][0]+" Diet Sprite("+quantity[5][0]
+") $0."+prices[5][1]+" Hershey's("+quantity[5][1]
+") $0."+prices[5][2]+" Peanuts("+quantity[5][2]+") ");
return display.toString();
}
}
TestVendingMachine.java
import javax.swing.*;
import java.io.Console;
public class TestVendingMachine
{
public static void main(String[] args) throws VendingMachineException
{
int deposit = 0;
int change = 0;
String choice = null;
5. Console console = System.console();
if (console != null)
{
// create VendingMachine object
console.format("Beginning Vending Machine Simulation.%n%n");
VendingMachine vm1 = new VendingMachine(); // create a new vending machine object
console.format("%s%n%n",vm1);
deposit = Integer.parseInt(console.readLine("Enter money as integer (e.g., 50) or 0 to
exit: "));
while(deposit > 0)
{
vm1.depositMoney(deposit);
choice = console.readLine("Please make a selection (e.g., A1): ");
change = vm1.buyItem(choice);
console.format("%nDispensing ...%n%n");
console.format("%s%n",vm1);
console.format("Change returned = %d%n%n",change);
deposit = Integer.parseInt(console.readLine(" Enter money as integer (e.g., 50) or 0 to
exit: "));
}
if(vm1.getDeposit() > 0)
console.format("%nReturning change: $0.%d%n.", vm1.getChange());
console.format("%nEnd of program.%n");
}
else
throw new VendingMachineException("No Console.");
}
}
VendingMachineException.java
public class VendingMachineException extends Exception
{
public VendingMachineException(String ex)
{
super(ex);
}
}
6. Sample Output Beginning Vending Machine Simulation Price A (in stock) Price B in stock)
Price C (in stock) $0.65 Snickers (1) $0.75 Pepsi (3) $0.30 Potato Chips (0) 2 $0.80 Diet
Pepsi(4) $0.60 Resse's Cup(6) $0.35 Ruffles (5) $0.40 Fritos(4) $0.70 Dr. Pepper(7) $0.55
M&Ms; (reg) (5) M $0.75 Diet Dr. P(5) $0.60 Peanut M&Ms; (0) $0.45 Doritos (5) $0.60 Sprite
(0) $0.45 Twisters (4) $0.50 Almonds (0) 6 $0.65 Diet Sprite(6) $0.40 Hershey's(4) $0.35
Peanuts (3) Enter money as integer (e.g 50) or 0 to exit: 65 Please make a selection (e.g., A1):
BA Error: Vending Machine Out of stock on this item: Peanut M&Ms; ost: $0.60 nter money as
integer (e.g 50) or 0 to exit 5 Please make a selection (e.g., A1): A3 Dispensing Price A (in
stock) Price B (in stock Price C (in stock) $0.75 Pepsi (3) $0.65 Snickers (1) $0.30 Potato Chips
(0) 2 $0.80 Diet Pepsi(4) $0.60 Resse's Cup (6) $0.35 Ruffles (5) 3 $0.70 Dr. Pepper (6) $0.55
M&Ms; (reg) (5) $0.40 Fritos (4) 4 $0.75 Diet Dr. P(5) $0.60 peanut M&Ms; (0) $0.45 Doritos
(5) 6 $0.60 Sprite (0) $0.45 Twisters (4) $0.50 Almonds (0) 5 $0.65 Diet Sprite (6) $0.40
Hershey's(4) $0.35 Peanuts (3) change returned $0.00 Enter money as integer (e.g 50) or 0 to
exit: 25 Please make a selection (e.g., A1): B1 Error: Vending Machine Insufficient funds for
item: Snickers Cost: $0.65, Deposited: $0.25 nter money as integer (e.g 50) or 0 to exit: 90
Please make a selection (e.g., A1): B1 Price A (in stock Price B (in stock) Price C (in stock)
$0.75 Pepsi(3) $0.65 Snickers (0) $0.30 Potato Chips (0) 2 $0.80 Diet Pepsi(4) $0.60 Resse's
Cup (6) $0.35 Ruffles (5) 3 $0.70 Dr. Pepper(6) $0.55 M&Ms; (reg) (5) $0.40 Fritos (4) 4 $0.75
Diet Dr. P(5) $0.60 peanut M&Ms; (0) $0.45 Doritos (5) $0.45 Twisters (4) 5 $0.60 Sprite(0)
$0.50 Almonds (0) 6 $0.65 Diet Sprite(6) $0.40 Hershey's(4) $0.35 Peanuts(3) Change returned
$0.50 50) or 0 to exit: 1 Enter money as integer (e.g Please make a selection (e.g A1): A7 Invalid
item selection: A7 Error: Vending Machine Enter money as integer (e.g 50) or 0 to exit 25 Please
make a selection (e.E A1): C3 Error: Vending Machine Insufficient funds for item: Fritos Cost:
$0.40, Deposited: $0.26 Enter money as integer (e.g 50) or 0 to exit: 20 Please make a selection
(e.g A1): B5 Dispensing Price A (in stock) Price B (in stock) Price C (in stock) $0.75 Pepsi(3)
$0.65 Snickers (0) $0.30 Potato Chips (0) $0.60 Resse's Cup(6) $0.35 Ruffles (5) 2 $0.80 Diet
Pepsi $0.70 Dr. Pepper(6) $0.55 M&Ms; (reg)(5) $0.40 Fritos (4) A $0.75 Diet Dr. P(5) $0.60
Peanut M&Ms;(0) $0.45 Doritos (5) 5 $0.60 Sprite (0) $0.45 Twisters (3) $0.50 Almonds (0) 5
$0.65 Diet Sprite(6) $0.40 Hershey's(4) $0.35 Peanuts (3) hange returned $0.01 Enter money as
integer (e.g 50) or 0 to exit: 0 End of program ress any key to continue
Solution
Please follow the code and comments for descritpion :
CODE :
a) TestVendingMachine.java :
7. import javax.swing.*; // required imports
import java.io.Console;
public class TestVendingMachine { // class to run the code
public static void main(String[] args) throws VendingMachineException { // driver method
int deposit = 0; // required local variables
int change = 0;
String choice = null;
Console console = System.console();
if (console != null) { // check for the console
// create VendingMachine object
console.format("Beginning Vending Machine Simulation.%n%n");
VendingMachine vm1 = new VendingMachine(); // create a new vending machine object
console.format("%s%n%n", vm1);
deposit = Integer.parseInt(console.readLine("Enter money as integer (e.g., 50) or 0 to exit: "));
while (deposit > 0) {
vm1.depositMoney(deposit);
choice = console.readLine("Please make a selection (e.g., A1): ");
change = vm1.buyItem(choice);
if (change < 0) { // check for the change returned
deposit = Integer.parseInt(console.readLine(" Enter money as integer (e.g., 50) or 0 to exit:
"));
} else { // if not then continue the loop
console.format("%nDispensing ...%n%n");
console.format("%s%n", vm1);
console.format("Change returned = $0.%d%n%n", change);
deposit = Integer.parseInt(console.readLine(" Enter money as integer (e.g., 50) or 0 to exit:
"));
}
}
if (vm1.getDeposit() > 0) {
console.format("%nReturning change: $0.%d%n.", vm1.getChange());
}
console.format("%nEnd of program.%n");
} else {
throw new VendingMachineException("No Console.");
}
12. Cost: $0.60
Enter money as integer (e.g., 50) or 0 to exit: 5
Please make a selection (e.g., A1): A3
Dispensing ...
Price A (in stock) Price B (in stock) Price C (in stock)
1 $0.75 Pepsi(3) $0.65 Snickers(1) $0.30 Potato Chips(0)
2 $0.80 Diet Pepsi(4) $0.60 Resse's Cup(6) $0.35 Ruffles(5)
3 $0.70 Dr. Pepper(6) $0.55 M&Ms (reg)(5) $0.40 Fritos(4)
4 $0.75 Diet Dr. P(5) $0.60 Peanut M&Ms(0) $0.45 Doritos(5)
5 $0.60 Sprite(0) $0.45 Twisters(4) $0.50 Almonds(0)
6 $0.65 Diet Sprite(6) $0.40 Hershey's(4) $0.35 Peanuts(3)
Change returned = $0.0
Enter money as integer (e.g., 50) or 0 to exit: 25
Please make a selection (e.g., A1): B1
*** Error: Vending Machine - Insufficient funds for item: Snickers
Cost: $0.65, Deposited: $0.25
Enter money as integer (e.g., 50) or 0 to exit: 90
Please make a selection (e.g., A1): B1
Dispensing ...
Price A (in stock) Price B (in stock) Price C (in stock)
1 $0.75 Pepsi(3) $0.65 Snickers(0) $0.30 Potato Chips(0)
2 $0.80 Diet Pepsi(4) $0.60 Resse's Cup(6) $0.35 Ruffles(5)
3 $0.70 Dr. Pepper(6) $0.55 M&Ms (reg)(5) $0.40 Fritos(4)
4 $0.75 Diet Dr. P(5) $0.60 Peanut M&Ms(0) $0.45 Doritos(5)
5 $0.60 Sprite(0) $0.45 Twisters(4) $0.50 Almonds(0)
6 $0.65 Diet Sprite(6) $0.40 Hershey's(4) $0.35 Peanuts(3)
Change returned = $0.50
Enter money as integer (e.g., 50) or 0 to exit: 1
Please make a selection (e.g., A1): A7
*** Error: Vending Machine - Invalid item selection: A7
Enter money as integer (e.g., 50) or 0 to exit: 25
Please make a selection (e.g., A1): C3
*** Error: Vending Machine - Insufficient funds for item: Fritos
Cost: $0.40, Deposited: $0.26
Enter money as integer (e.g., 50) or 0 to exit: 20
Please make a selection (e.g., A1): B5
13. Dispensing ...
Price A (in stock) Price B (in stock) Price C (in stock)
1 $0.75 Pepsi(3) $0.65 Snickers(0) $0.30 Potato Chips(0)
2 $0.80 Diet Pepsi(4) $0.60 Resse's Cup(6) $0.35 Ruffles(5)
3 $0.70 Dr. Pepper(6) $0.55 M&Ms (reg)(5) $0.40 Fritos(4)
4 $0.75 Diet Dr. P(5) $0.60 Peanut M&Ms(0) $0.45 Doritos(5)
5 $0.60 Sprite(0) $0.45 Twisters(3) $0.50 Almonds(0)
Change returned = $0.1
Enter money as integer (e.g., 50) or 0 to exit: 0
End of program.
Hope this is helpful.