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

Suppose you are done eating at a restaurant and have some food leftover that you

ID: 3581640 • Letter: S

Question

Suppose you are done eating at a restaurant and have some food leftover that you’d like to take home. You’ve brought with you a Tupperware dish that will hold up to 10 oz of food. The following items are available for you to take with you:

2 pieces of shrimp, each 3 oz, and, on a scale from 1-10 (10 is best), you rate each shrimp an 6

6 oz of steak, which you rate 7 on the 1-10 scale

a 2 oz piece of sourdough bread which you rate a 2 on the 1-10 scale since there is no butter remaining

a. Formulate an integer program that will optimize the leftovers you take home.

b. Solve this problem.

Explanation / Answer

//Following code works upon the basic implementation of the question, it calculates all things which a resaurant counter person will feed upon in system.

package com.demo;
import java.util.Scanner;
    public class CarryAwayCalc {
static int itemsct,wgt,ttlwgt;
static int abttocarrywgt,avgrating;
char ch;

public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner in=new Scanner(System.in);
System.out.println("Enter the overall rating;");
avgrating=in.nextInt();
System.out.println("Enter your total number of item to carry;");
itemsct=in.nextInt();
System.out.println("Enter total weight of items to carry;");
ttlwgt=in.nextInt();
System.out.println("Enter your container weight;");
abttocarrywgt=in.nextInt();
if ((ttlwgt<=abttocarrywgt)&&(avgrating>=5)){
  System.out.println("You can carry the all left items");
        }else if((ttlwgt>abttocarrywgt)&&(avgrating<=5)){
  System.out.println("Sorry you can not take more items weighing more than your containers weight.");
}
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote