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

Scenario: You have decided to run a food truck with your friend that sells salad

ID: 3885720 • Letter: S

Question

Scenario: You have decided to run a food truck with your friend that sells salads to the Mason community. For the truck to be successful, you must create an application that helps determine the total cost to purchase one salad. The cost of one salad is determined by the number of ingredients contained within it and the type of salad dressing it contains, if any. The only possible options for salad dressing are: No Dressing, Balsamic Vinaigrette, Bleu Cheese, or Thousand Island. Note that salad dressing does not count as an ingredient. Working with your friend, you decide upon the following rules to help you determine the cost for one salad: Each salad has a base cost of $9.39 When the salad contains three ingredients or less, there is no additional charge When the salad contains more than three ingredients, but fewer than seven ingredients, there is an additional $2.85 charge When the salad contains seven or more ingredients, there is an additional $4.25 charge Selecting no salad dressing or Balsamic Vinaigrette adds no additional charge to the total salad cost, but selecting Bleu Cheese or Thousand Island adds an additional $1.29 to the salad cost All salads must be charged an additional 8.25% for sales tax of the total salad cost Create an application that will ask the user to provide the number of ingredients the salad will contain followed by the type of salad dressing the salad will contain, if any. Print a well-formatted report that displays the salad's base cost, the number of ingredients in the salad, the type of dressing selected (if any), the total cost of the salad before tax, the amount of the tax, and the grand total (including tax) While working with the program, if the user enters in any invalid values, the program must provide an error message, inform the user they should manually restart the program, and then immediately end. Programming Assignment 1: Solution Design Show testing using the desk checking table method, to include test data, expected results, and a desk checking table. Make sure your desk checking considers multiple cases including both valid and invalid test data to prove your algorithm will work in all cases

Explanation / Answer

you did not mention language specifics, so i am writing it in java but underlined code can be used in any programming language, just use respective print statement and method for accepting input

import java.util.Scanner;
public class Solution {

   public static void main(String[] args) {
       // TODO Auto-generated method stub
       Double additional_cost=0.0;
       Double base_cost=9.39;
       Scanner scan=new Scanner(System.in);
       System.out.println(" how many ingredients salad will contain?");
       int ingred=scan.nextInt();
       System.out.println(" what type of dressing salad will contain(if any)? select appropriate number");
       System.out.println("1. No Salad Dressing");
       System.out.println("2. Balsamic Vinaigrette");
       System.out.println("3. Bleu Cheese");
       System.out.println("4. Thousand Island");
      
       int num=scan.nextInt();
       if(num>4 || num<=0)
       {
           System.out.println("select appropriate number, else no salad will be selected");
           num=scan.nextInt();
       }
       if(ingred<=3)
       {
           additional_cost=0.0;
       }else if(ingred>3 && ingred<7)
       {
           additional_cost=2.85;
       }else{
           additional_cost=4.25;
       }
       String Dressing="";
       switch(num) {
       case 1: Dressing+="No Salad Dressing";
       break;
       case 2: Dressing+="Balsamic Vinaigrette";
       break;
       case 3 :additional_cost+=1.29;Dressing+="Bleu Cheese";
       break;
       case 4: Dressing+="Thousand Island";additional_cost+=1.29;
       break;
       default:Dressing+="No Salad Dressing";
       break;
       }
       double beforeTax=base_cost+additional_cost;
       double afterTax=((0.0825)*beforeTax)+beforeTax;
       System.out.println("****************Bill*****************");
       System.out.println();
       System.out.println("Salad's base cost          "+"$"+base_cost);
       System.out.println("Number of Ingredients     "+ingred);
       System.out.println("Type of Dressing               "+Dressing);
       System.out.println("---------------------------------------------");
       System.out.println("Total cost(before tax)     "+"$"+beforeTax);
       System.out.println("Amount of tax(8.25%)       "+"$"+(0.0825*beforeTax));
       System.out.println("---------------------------------------------");
       System.out.println("Total cost(after tax)     "+"$"+afterTax);

   }
  

}

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