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

any language used (Java,html.....) please i need help,, even if it is not coded

ID: 3555666 • Letter: A

Question

any language used (Java,html.....)
please i need help,, even if it is not coded all,,, just some code....

The purpose of this project is to alow customers from anywhere to purchase products from the grocery store.

The goal of this website is to raise customer staisfaction service and increase profits. We are a small grocery store that has ten products available. One idea that would be nice would to click on the picture with a name above and it would take the customer to a product description page. On this description page, it will need about five different sub-describtion as well as an option to add to cart with an option up to ten of the same item. On this descritpion page we need the price, and it must be uniform for all products. This system must give a warning for all low stocked items after the quantity falls below the predetermined minimum. The cart must provideup to date items and calculate the total of the customer purchase with a summary of the products placed in the cart. After there wil be an option to sign in or order by entering in the customers information. Then the customer can confirm or enter in a shipping and billing address into the system and go to the next step. The stop after this is to choose delivery(by bicycle) and have a display for the fee whether it be calculated based on distance or a flat rate or pick-up. The second to last step is to enter the payment method for the order and lastly a summary of the previous choices made all on one final page. This page will b e saved as an invoice sent to both the customer and business owner.

Explanation / Answer

import java.util.ArrayList;
import java.util.Iterator;

public class GroceryStore
{
ArrayList myItems;
  
/**
* Creates an initially empty grocery store
*/
public GroceryStore()
{
   myItems = new ArrayList();
}


/**
* Changes the price of the item associated with itemName
*/
  
public void setPrice(String itemName, double price)
{
   GroceryItem item = getItem(itemName);
   if (item != null) {
   ( (GItem) item).price = price;
   }
}

/**
* returns the item associated with itemName
*/
  
public GroceryItem getItem(String itemName)
{
   return getGItem(itemName);
}

/**
* returns a (possibly empty) ArrayList of all
* the items in the specified category
*/
  
public ArrayList getAllItems(String category)
{
   ArrayList list = new ArrayList();
   for(int k=0; k < myItems.size(); k++) {
   GItem item = (GItem) myItems.get(k);
   if (item.getCategory().equals(category)) {
       list.add(item);
   }
   }
   return list;
}

/**
* precondition: names.length == prices.length
* changes the price of the item associated with names[k]
* to the price specified by prices[k]
*/
  
public void changePrices(String[] names, double[] prices)
{
   for(int k=0; k < names.length; k++) {
   setPrice(names[k],prices[k]);
   }
}


private GItem getGItem(String itemName)
{
   Iterator it = myItems.iterator();
   while (it.hasNext()) {
   GItem gitem = (GItem) it.next();
   if (gitem.getName().equals(itemName)) {
       return gitem;
   }
   }
   return null;
}
  
private class GItem implements GroceryItem
{
   String name;
   double price;
   String category;
   int size;
   public String getName() { return name; }
   public double getPrice() { return price; }
   public int getSize() { return size; }
   public String getCategory() { return category; }
}
  
}


Example program 2:


public class GroceryStore {
  
// instance variables
Clerk myClerk;
public int KINDS_OF_ITEMS = 4;
public GroceryItem[ ] item = new GroceryItem[KINDS_OF_ITEMS];
public int[ ] itemCount = new int[KINDS_OF_ITEMS];
double money = 1000.00;
  
// constructor
GroceryStore() {
item[0] = new GroceryItem("milk", 2.12);
item[1] = new GroceryItem("butter", 2.50);
item[2] = new GroceryItem("eggs", 0.89);
item[3] = new GroceryItem("bread", 1.59);
for (int i = 0; i < KINDS_OF_ITEMS; i++) {
itemCount[i] = 50; // the store has lots of everything
}
}
  
public static void main(String args[]) {
GroceryStore store = new GroceryStore();
Clerk clerk = new Clerk();
store.hire(clerk);
Customer customer = new Customer();
customer.shop(store);
}
  
public void hire(Clerk clerk) {
myClerk = clerk;
clerk.takePosition(this); // "this" = this store
}
  
public Clerk getClerk() {
return myClerk;
}
}

Customer.java
import java.util.*; // for Random

public class Customer {
  
GroceryItem[ ] myShoppingBasket = new GroceryItem[20];
Random random = new Random();
double myMoney = 100.00;
  
public void shop(GroceryStore store) {
selectGroceries(store); // because the store holds the groceries
checkOut(store);
}
  
public void selectGroceries(GroceryStore store) {
int itemsInMyBasket = 0;
for (int i = 0; i < store.KINDS_OF_ITEMS; i++) { // for each kind of item
for (int j = 0; j < 3; j++) { // choose up to 3 of it
if (random.nextInt(2) == 1) {
myShoppingBasket[itemsInMyBasket] = store.item[i];
store.itemCount[i] = store.itemCount[i] - 1;
itemsInMyBasket = itemsInMyBasket + 1;
}
}
}
}
  
void checkOut(GroceryStore store) {
Clerk clerk = store.getClerk();
double total = clerk.ringUp(myShoppingBasket);
myMoney = myMoney - total;
clerk.pay(total);
}
}

Clerk.java
public class Clerk {

GroceryStore myStore;

public void takePosition(GroceryStore store) {
myStore = store;
}
  
public double ringUp(GroceryItem[] item) {
double total = 0;
int itemNumber = 0;
while (item[itemNumber] != null) {
total = total + item[itemNumber].price;
System.out.println(item[itemNumber].name + " " +
item[itemNumber].price);
itemNumber = itemNumber + 1;
}
System.out.println("TOTAL " + total);
return total;
}
  
public void pay(double amount) {
myStore.money = myStore.money + amount;
}
}

GroceryItem.java
public class GroceryItem {

// Instance variables
public String name;
public double price;
  
// Constructor
GroceryItem(String name, double price) {
this.name = name;
this.price = price;
}
}


Example program 3:

import java.util.Scanner;
public class groceryshopping{
public static void main(String args[]){
  
Scanner input = new Scanner(System.in);
  
int choice = 1;
double subtotal = 0;
double price = 0;
double discount = 0;
  
do {
System.out.println("Steve's Groceries");
System.out.println(" ");
System.out.println("1. Apples $ 1.99 per lbs");
System.out.println("2. Oranges $ 2.19 per lbs");
System.out.println("3. Chocolate Bar $ 0.99 each");
System.out.println("4. Ice Cream $ 3.49 a carton");
System.out.println("5. Watermelon $ 0.88 per lbs");
System.out.println("6. Cottage Cheese $ 1.29 package");
System.out.println("7. Mushrooms $ 1.59 per lbs");
System.out.println("8. NY Strip Steak $ 7.99 per lbs");
System.out.println("9. Pizza $ 4.99 each");
System.out.println("10. Strawberries $ 2.49 each");
System.out.println("");
System.out.println("0. Quit");
System.out.println("");
  
System.out.println("Your subtotal is $ " +(int)(subtotal * 100) / 100.0);
System.out.println("What would you like to purchase? If you have completed your checkout, enter 0.");
choice = input.nextInt();
  
if (choice == 0)
break;
  
System.out.println("How many do you want?");
int qty = input.nextInt();
  
switch (choice) {
case 1:
price = 1.99;
break;
case 2:
price = 2.19;
break;
case 3:
price = 0.99;
break;
case 4:
price = 3.49;
break;
case 5:
price = 0.88;
break;
case 6:
price = 1.29;
break;
case 7:
price = 1.59;
break;
case 8:
price = 7.99;
break;
case 9:
price = 4.99;
break;
case 10:
price = 2.49;
}
subtotal = subtotal + (qty * price);
}

while(choice > 0);

System.out.println("Are you a member of the A+ discount club? (Y/N)");
String discountInput = input.next();
char discountClub = discountInput.charAt(0);
  
if (discountClub == 'y' || discountClub == 'Y'){
discount = subtotal * .20;
}

double tax = ((subtotal - discount) * 0.075);
double finalCost = subtotal - discount + tax;

System.out.println("The subtotal is $ " + (int)(subtotal * 100) / 100.0);
System.out.println("A+ Member's Discount $ " + (int) (discount * 100) / 100.0);
System.out.println("Sales Tax $ " + (int)(tax* 100) / 100.0);
System.out.println("Final price $ " + (int)(finalCost * 100) / 100.0);
}
}