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

Question 1 (8 points) Purpose: Practice with getting data from functions. Some b

ID: 3860097 • Letter: Q

Question

Question 1 (8 points) Purpose: Practice with getting data from functions. Some basic numerical problem-solving Degree of Difficulty: Moderate At the local supermarket, hotdogs are sold in packages containing a dozen (12) hotdogs, and yet hotdog buns are sold in packages containing 8 buns. One question we can ask is this: given some number of packages of dogs and buns, how many hotdogs can we make (one dog per bun)? In this problem, you'll answer that question. Before we get started, let's resolve some ambiguity. A hotdog can mean the sausage alone, or the sandwich you get when you combine a sausage and a bun. So, from now on, we'll call the sausage a "frank', a hotdog bun will be called a "bun" and the complete sandwich is called a hotdog. Got it? Here is a description of WHAT your program should do when it's finished: . Pressing the .f keyrg. key increases/decreases the number of frank packages purchased by one . Pressing the .b'keyrn. key increases/decreases the number of bun packages purchased by one Display the current number of frank packages, current number of bun packages, and the current number of hotdogs you can make (one frank per bun) Some examples: . If you have 2 packages of franks (24 franks tota), and 3 packages of buns (24 buns tota), you can make 24 complete hotdogs, and there will be no extra buns or franks If you have 1 package of franks (12 franks), and 2 packages of buns (16 buns), you can make 12 com plete hotdogs, and you will have 4 extra buns If you have 2 packages of franks (24 franks) and 2 packages of buns (16 buns) you can make 16 com plete hotdogs, and there will be 8 extra franks Now, here is a description of HOW you should write the program: Start by understanding the problem: Read the question carefully, and identify the things you are sure about, and the things you are unsure about. If you have any questions, make sure to ask an instructor, a TA or post on the class discussion forums Next, prepare some test cases. A test case is a set of input values for the program where you will be

Explanation / Answer

package com.stm.test;

import java.util.Scanner;

public class HotDog {

static Scanner s = new Scanner(System.in);

public static void main(){

System.out.println("Please Enter the number of bun present :");

int bunpackages = s.nextInt();

System.out.println("The number of Bun Packages present is "+bunpackages);

System.out.println("Please Enter the number of sausage present :");

int frankpackages = s.nextInt();

System.out.println("The number of Sausage present is "+frankpackages);

if (bunpackages==frankpackages)

{

System.out.println("The number of Hot dog can be made is:"+frankpackages);

/*else

{

System.out.println("The number of Hot dog can be made is:"+bunpackages);

}*/

}

}

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