subject
Computers and Technology, 26.06.2020 21:01 kebo63

Complete method printPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bagOunces followed by "seconds". End with a newline. Example output for ounces = 7: 42 seconds
Sample program:
import java. util. Scanner;
public class PopcornTimer {
public static void printPopcornTime(int bagOunces) {
/* Your solution goes here */
}
public static void main (String [] args) {
printPopcornTime(7);
return;
}
}
6.6.1:
Add two more statements to main() to test inputs 3 and -1. Use print statements similar to the existing one (don't use assert).
Sample program:
import java. util. Scanner;
public class UnitTesting {
// Function returns origNum cubed
public static int cubeNum(int origNum) {
return origNum * origNum * origNum;
}
public static void main (String [] args) {
System. out. println("Testing started");
System. out. println("2, expecting 8, got: " + cubeNum(2));
/* Your solution goes here */
System. out. println("Testing completed");
return;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:40
Write a function 'music_func' that takes 3 parameters -- music type, music group, vocalist -- and prints them all out as shown in the example below. in case no input is provided by the user, the function should assume these values for the parameters: "classic rock", "the beatles", "freddie mercury". for example: input: alternative rock,pearl jam,chris cornell output: the best kind of music is alternative rock the best music group is pearl jam the best lead vocalist is chris cornell note: the print statements will go inside the for example: print("the best kind of music is"
Answers: 2
question
Computers and Technology, 22.06.2019 19:20
Write a program that prompts the user to input a string. the program then uses the function substr to remove all the vowels from the string. for example, if str = "there", then after removing all the vowels, str = "thr". after removing all the vowels, output the string. your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
Which of the following characters is acceptable to use in a filename? ? / – %
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
The database design steps are listed below in the incorrect order. choose the correct order number next to each step. determine the information to be stored in the database. determine the fields needed to record the data determine if there will be any repetition of data entered, and separate the fields into tables to normalize the data. create relationships to connect the tables.
Answers: 3
You know the right answer?
Complete method printPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces...
Questions
question
Chemistry, 11.02.2020 04:52
question
Mathematics, 11.02.2020 04:52