3. Explain the output of this program
Q: PLEASE USE PYTHON PLEASE (give the same output as the instruction given) Program Specifications…
A: \course = input() if course == 'UG' or course == 'G' or course == 'DL': homework, quizzes, mdtm,…
Q: Q-No.6: Write the output of the following program. (1 tinclude *include using namespace std; class…
A: First, the program controller goes to the main() function. Then the object os String class is…
Q: List to Dictionary Function for Fantasy Game Inventory Imagine that a vanquished dragon's loot is…
A: Fantasy Game Inventory You are creating a fantasy video game. The data structure to model the…
Q: Show the output of the following two programs:
A: (a) Code screenshot Output of (a) is:
Q: Show the output of the following two programs:
A: Given: Show the output of the following two programs:
Q: Explain the output of this program
A: In the given program, the Scanner class is initialized to read user input. Using Scanner's object,…
Q: What is the output of the following * !program int main(void) {
A: Please find the answer below :
Q: Print the two strings, firstString and secondString, in alphabetical order. Assume the strings are…
A: First, we will input both strings. Then using if-else, we will compare the strings. And in the end,…
Q: void foo (const char* s) { const int* p = (int*) (s int i-3; while(i){ printf("%c", *C(char %3D p++;
A: The explanation is in the following step.
Q: نقطتان )2( What is the output of the following ?program #include int main() { for(int i=1;i<8;i++) {…
A: Program is given by: #include <stdio.h> int main(){ for(int i=1;i<8;i++) {…
Q: Process of dividing program parts into more detailed part is classified as a. step-wise refinement…
A: Dividing programs into more detailed parts is done for providing easiness for the developer and…
Q: Program this
A: The Answer is :-
Q: Main.java DrivingCost.java 1- import java.util.Scanner; 3 public class DrivingCost 4-{ 5 6 public…
A: Let's see the solution in the next steps
Q: Is it time for tea? Your friend lives in London England in a timezone that is normally 6 hours ahead…
A: The Python Code is given below with code and output screenshot Happy to help you ?
Q: Create a file named minesweeper.py Create a function that takes a grid of # and -, where each hash…
A: #-----------------------------------------------------------------------#…
Q: USE PYTHON PLEASE (give the same output as the instruction given) Program Specifications Write a…
A: \course = input() if course == 'UG' or course == 'G' or course == 'DL': homework, quizzes, mdtm,…
Q: Discuss in your own word the function and output of the two programs.
A: The question is on discussing in your own word the function and output of the two programs.
Q: Case study: An event company asks you to design the data structure and program prototype for their…
A: To begin the problem solving, suppose that 10 registered runners need to be stored in a hash table,…
Q: 3. Locate the error in each of the following program segments and explain how to correct it.
A: Answer d: because it is in infinite loop so , we take --y. Right code: var y=5; while(y>0){…
Q: Mad Libs are activities that have a person provide various words, which are then used to complete a…
A: The python program is given elow:
Q: Character Picture Grid Say you have a list of lists where each value in the inner lists is a…
A: In above question not mention the language so we did it java
Q: Implement textbook (9/E) problem 7.28 in page 303. The problem statement is reproduced next: 7.28…
A: Java is a high-level, class-based, object-oriented programming language that is widely used for…
Q: ust show it in Python: Please show step by step with comments. Please show it in simplest form.…
A: Required: Must show it in Python:
Q: Identifiers declared inside a block: scope { // block begins int x; // local in block x = 9;…
A: In Java, the terms "inner block" and "outer block" typically refer to nested blocks of code within a…
Q: 9 import java.util.Scanner; 10 //Creating a class 11 - public class Main{ 12 // Driver code public…
A: the output is tax calculation based onn input amount and then the total amount including tax.
Q: Python Function In your own words, answer the following questions
A: Function:- It is a block of statements that performs a particular task. Advantages:- function…
Q: X=min of X,Y,Z .DATA 007 Y 002
A: int x=7,y=2,z=9; if(y>z) then if(z>x) then y=x; else y=z; end else…
Q: Assume that a bank maintains two kinds of accounts for customers: a savings account and the other as…
A: Below I have provided a program for the given question. Also, I have attached a screenshot of the…
Q: 7. Write a function vector merge(vector a, vector b) that merges two arrays, alternating elements…
A: Here is your solution step by step -
3. Explain the output of this
Step by step
Solved in 2 steps
- public class Driver { /** * @param args */ static Scanner keyboard = new Scanner(System.in); publicstaticvoid main(String[] args) { Mailbox[] mailboxes = new Mailbox[5]; Mailbox mailbox1 = new Mailbox("gmail"); Mailbox mailbox2 = new Mailbox("outlook"); Mailbox mailbox3 = new Mailbox("icloud"); mailboxes[0] = mailbox1; mailboxes[1] = mailbox2; mailboxes[2] = mailbox3; Email email1 = new Email(); email1.setDate(new Date(2022, 11, 5)); email1.setSubject("Exam2 guidelines "); Email email2 = new Email(new Date(2021, 3, 5), true, "Quiz3 in Ch7"); Email email3 = new Email(); email3.setDate(new Date(2020, 11, 3)); email3.setSubject("Late submission policy"); mailbox2.addEmail(email1); mailbox2.addEmail(email2); mailbox2.addEmail(email3); // System.out.println("Hello! What would you like to do "); intselection = displayMenu(); while (selection != 5) { // selection = displayMenu(); switch (selection) { case 1: System.out.print("Enter the client: "); String…JAVA CODE: check outputFIX THE CODE PROVIDED BELOW Part 2 - Syntax Errors and Troubleshooting The code below has many syntax (and other) errors. Tasks:Compile the code and fix the errors one at a time. // Lab1a.java // This short class has several bugs for practice. // Authors: Carol Zander, Rob Nash, Clark Olson, you public class Lab1a { public static void main(String[] args) { compareNumbers(); calculateDist(); } publicstatic void compareNumbers() { int firstNum = 5; int secondNum; System.out.println( "Sum is: + firstNum + secondNum ); System.out.println( "Difference is: " + (firstNum - secondNum ); System.out.println( "Product is: " + firstNun * secondNum ); } public static void calculateDistance() { int velocity = 10; //miles-per-hour int time = 2, //hoursint distance = velocity * timeSystem.out.println( "Total distance is: " distanace); } } Part 3 - Print Statements and Simple Methods Use "print" and "println" statements, but use method calls to reduce the number of repeated "print"and "println"…
- TASK 3. Console Input and Output. Review Scanner class and its methods, Implement the following code, make sure it runs without errors. 1 package 1lessons; 3 import java.util.Scanner; 4 5 public class ReportSum3 { public static void main(String args[]) { Scanner sc = new Scanner(System. in); 60 7 8 // Prompt the user to enter the first integer System.out.println("Enter the value for 'a' and press Enter: "); int a = sc.nextInt(); // Prompt the user to enter the second integer System.out.println("Enter the value for 'b' and press Enter: "); int b = sc.nextInt(); 10 11 12 13 14 15 16 17 18 19 20 21 22 } //Close the Scanner. It's a good practice to release the resource that was acquired sc.close(); // Display the result System.out.printf( "Provided Integers: %4d and %4d, the total is %5d\n", a, b, (a + b)); } To simplify the task, we came out with the idea to use Methods. Implement a method to add two integers.CENGAGE MINDTAP Q Search Programming Exercise 3-9 Instructions Insurance.java + >- Terminal + 1 import java.util.Scanner; sandbox $ | 2 class Insurance { The Harrison Group Life Insurance company computes annual public static void main (String args[]) { // Write your code here policy premiums based on the age the customer turns in the 4 current calendar year. The premium is computed by taking the 5 } decade of the customer's age, adding 15 to it, and multiplying by public static int calculatePremium(int curr, int birth) { // Write your code here 20. 7 8 } 10 } 9 For example, a 34-year-old would pay $360, which is calculated by adding the decades (3) to 15, and then multiplying by 20. 11 Write an application that prompts a user for the current year then a birth year. Pass both to a method that calculates and returns the premium amount, and then display the returned amount. An example of the program is shown below: Enter the current year >> 2020 Enter the birth year >> 2001 The premium…mport java.util.Scanner; public class ParkingCharges { // function to calculate the basic charge using the asked hours static double getBasicCharge(int hours) { if (hours >= 7 && hours <= 8) return 5.50; else if (hours >= 5 && hours <= 6) return 4.50; else if (hours >= 2 && hours <= 4) return 4.00; return 3.00; } // function to return the amount to subtract based on local living and OAP static double getDiscount(String isLocal, String isOAP) { if (isOAP.equals("Yes") && isLocal.equals("Yes")) return 2.0 + 1.0; else if (isOAP.equals("Yes")) return 2.0; else if (isLocal.equals("Yes")) return 1.0; return 0; } public static void main(String[] args) { // create a new Scanner object Scanner sc = new Scanner(System.in); // prompt the user to ask if they are disabled…
- Fix all the errors and send the code please // Application looks up home price // for different floor plans // allows upper or lowercase data entry import java.util.*; public class DebugEight3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String entry; char[] floorPlans = {'A','B','C','a','b','c'} int[] pricesInThousands = {145, 190, 235}; char plan; int x, fp = 99; String prompt = "Please select a floor plan\n" + "Our floorPlanss are:\n" + "A - Augusta, a ranch\n" + "B - Brittany, a split level\n" + "C - Colonial, a two-story\n" + "Enter floorPlans letter"; System.out.println(prompt); entry = input.next(); plan = entry.charAt(1); for(x = 0; x < floorPlans.length; ++x) if(plan == floorPlans[x]) x = fp; if(fp = 99) System.out.println("Invalid floor plan code entered")); else { if(fp…12345678901 2 public class BMICalculation { 3- Y 10 import java.util.Scanner; 11 12 13 } public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.print("Enter your weight in pounds") in.nextInt (); System.out.print("Enter your height in inches") in.nextDouble(); double feet BMI bmi new BMI (weight, feet); System.out.println("BMI: } int weight w +bmi.getBMI()); System.out.println(bmi.getStatus()); line 9 i got two errors saying cannot find symbol* CENGAGE MINDTAP Programming Exercise 3-6 Instructions BookstoreCredit.java + 1 import java.util.Scanner; 2 public class BookstoreCredit { To encourage good grades, Hermosa High School has decided to public static void main (String args[]) { // Write your code here 3 award each student a bookstore credit that is 10 times the student's 4 grade point average. 5 } 6 public static void computeDiscount(String name, double gpa) { // Write your code here } In other words, a student with a 3.2 grade point average receives a 8 $32.0 credit. 10 Create an application that prompts a student for a name and grade 11 } point average, and then passes the values to a method ( 12 computeDiscount ) that displays a descriptive message. The message uses the student's name, echoes the grade point average, and computes and displays the credit. An example of the program is shown below: Enter your name >> John Enter your gpa >>3.4 John, your GPA is 3.4, so your credit is $34.0 Grading Write your Java code in…
- Instructions ChiliToGo.java >- Terminal 1 import java.util.Scanner; sandbox $ 0 2 class ChiliToGo { The Huntington Boys and Girls Club is conducting a 3 public static void main(String[] args) { Llal fundraiser by selling chili dinners to go. The price is // Write your code here 4 $7.00 for an adult meal and $4.00 for a child's meal. 5 } Write a program that accepts the number of adult meals 6 } 7 ordered and then children's meals ordered. Display the total money collected for adult meals, children's meals, and all meals. An example of the program is shown below: Enter number of adult meals ordered >> 10 Enter number of child meals ordered >> 5 10 adult meals were ordered at 7.0 each. Total is 70.0 5 child meals were ordered at 4.0 each. Total is 20.0 Grand total for all meals is 90.0 Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade.…Code example 2-1import java.util.Scanner;public class InvoiceApp {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String choice = “y”;While (choice.equals(“y”)) {System.out.print("Enter subtotal: ");double subtotal = sc.nextDouble();double salesTax = subtotal * .0875;double invoiceTotal = subtotal + salesTax;String message = “Subtotal = ” + subtotal + “\n”+ “ Sales tax = ” + salesTax + “\n”+ “Invoice total = ” + invoiceTotal + “\n\n”System.out.println(message);System.out.print(“Continue? Enter y or n: ”);Choice = sc.next();}}}38. (Refer to code example 2-1.) If the user enters “Y” when asked if he/she wants to continue, the application will a. repeat the while loop b. display a blank line, then repeat the while loop c. EndCode example 2-1import java.util.Scanner;public class InvoiceApp {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String choice = “y”;While (choice.equals(“y”)) {System.out.print("Enter subtotal: ");double subtotal = sc.nextDouble();double salesTax = subtotal * .0875;double invoiceTotal = subtotal + salesTax;String message = “Subtotal = ” + subtotal + “\n”+ “ Sales tax = ” + salesTax + “\n”+ “Invoice total = ” + invoiceTotal + “\n\n”System.out.println(message);System.out.print(“Continue? Enter y or n: ”);Choice = sc.next();}}} (Refer to code example 2-1.) If the user enters 100 the first time the while loop is executed, what will the program display at the console? a. Subtotal: 100.0 Sales tax: 8.75 Invoice total: 108.75 b. Subtotal = 100.0 Sales tax = 8.75 Invoice total = 108.75 c. Subtotal = 100.0 Sales tax = 8.75Invoice total = 108.75 d. Subtotal = 100.0 Sales tax = 8.75Invoice total = 108.75