b) Explain why the value of numOne is still 100 at line 11 after passing it to method tripleInt() at line 9 c) Which syntax(s) need to modify for the value of numOne to be 300 after passing it to method tripleInt() at line 9? [Identify the line code and write the correct syntax(s)]
Q: Name: importantCalc Input/Parameters: integer, integer, double Output/Returns: double In the main…
A: b) num4= importantCalc(num1,num2,num3);
Q: Using the method printMe below, differentiate between overloading and overriding. printMe(String…
A: I have given an answer in step 2.
Q: a. Create the logic for a program that calculates and displays the amount of money you would have if…
A: a.Create the logic for a program that calculates and displays the amount of money you would have if…
Q: Correct the following wrong statements. 1. do … while repetition statement gives full control on the…
A:
Q: Define a method in JAVA that should take 4 numbers as the parameters and returns the average of all…
A: Here I have created the function named average(). In this function, I have added all 4 number passes…
Q: Write a method to print integer numbers from m to n, where m and n are the method parameters. The…
A: In the solution of problem, we use modulo operator to check the divisibility of loop counter with 5,…
Q: Questions are based on following code; the integer on each line indicates the line number that is…
A: Question 2: Arguments are actual values which are passed to variables defined in the method header…
Q: Note: Provide a copy of the code and sereen shot for the output in the solutions. Explain the…
A: In this programming question we have to write a C# program using method overloading To calculate…
Q: Complete the below method which returns the maximum of three numbers in java static int max(a, b,c)…
A: Required:- Complete the below method which returns the maximum of three numbers in java static int…
Q: Write a Java program that calls a method from main and passes it two integer parameters called…
A: The answer to the following question:-
Q: a) Write a procedural Java program ( procedural programming) for an artist who is creating art…
A: Solution: Given, Write a procedural Java program ( procedural programming) for an artist who…
Q: Define a method in JAVA that should take 4 numbers as the parameters and returns the average of all…
A: import java.util.* class main { public static double average(double a, double b, double c,…
Q: Write a program that will display the prime numbers in a given range. The program should allow users…
A: I have given an answer in step 2.
Q: (c) Write the statement to call the method max3 () in question 4(g).
A: Dear Student, To call a function we first declare a variable where we want the value to be stored…
Q: There are 3 parts to this question. Please give me the code for all the 3 parts. Any kind of help…
A: Actually, string is a sequence of characters.
Q: Write the method header for method Hypotenuse, which takes two double parameters side1 and side2,…
A: Please find the answer below :
Q: Flowchart, create. Writing Functions with No Parameters in Python #method to display the discount…
A: The program in given below
Q: PROBLEM STATEMENT: Return the factorial of the provided integer parameter. public class…
A: Return the factorial of the provided integer parameter. public class FactorialComputation{public…
Q: Use the built-in Math.min method of java in method named minimumNumber that returns the smallest of…
A: Algorithm: Start Read 3 floating-point numbers Implement a method minimumNumber() which takes 3…
Q: java program give comments please to explain. Write a program that calls these two methods as…
A: Below is the required Java program: - Approach: - Import the package to use the Scanner class.…
Q: VB.Net program to demonstrate the difference between Console.Write() and Console.WriteLine() method
A: b. Write a VB.Net program to demonstrate the difference between Console.Write() and…
Q: Write a program that asks the user to enter a character. Then pass the character to the following…
A: The required Java code is: import java.util.Scanner; public class Charactercheck{ public static…
Q: 1. Create a Java program with three static methods in addition to the main method 1) Factorial…
A: In the main class declare the static variable n1,n2 and n3. The static method Fibonacci() is defined…
Q: 120 (C) Write a program that will calculate any missing value in the following equation: grade =…
A: Find the java code attached.
Q: 2. A method named isAnOperation that takes a character and returns true if the character is one of…
A: Java code for question 2: public static Boolean isAnOperation(Character ch){ if(ch == '+'…
Q: 3) Write a method that computes the speeding penalties of cars. Given as inputs the speed of the…
A: The code has been written in Java as no programming language has been mentioned.
Q: 6.25 LAB: Track laps to miles One lap around a standard high-school running track is exactly 0.25…
A: According to the information given:- We have to follow the instruction in order to get the desired…
Q: Requests two double values from the user and stores them in local variables in main() - Create a…
A: Please find the answer below :
Q: If method i3 calls method i5, and method i5 calls method i7, and method i7 calls method i9, when…
A: THe solution for the above given question is given below:
Q: in Python Create the logic for a program that call calls a function that computes the final price…
A: Python program: def calculatePrice(price, com_rate, dis_rate): # Add the salesperson…
Q: In Java, methods must include all of the following except? a) Local variable/s b) Global…
A: A method is a collection of statements that perform some specific task and return the result to the…
Q: How would you read the expression x.y () (C++ code)? As: Select one: a. method y of object x b.…
A: The answer is as follows option b
Q: doubling the digits starting from the next-to-last one, yields 18 18 10 8. Adding all digits in…
A: CODE WITH COMMENTS #include <iostream>using namespace std; int main(){ int n;char ch;//…
Q: 5. Please write out the results displayed in the console after the following Java program is run.…
A: We are given a Java Code snippet and we need to determine the output when the code is executed.…
Q: T/F 5) If you call the following two methods with the same value of x, they would both return the…
A: Suppose x = 2 If method1(2) is called then it will return 0+1+1=2. On the other hand, if method2(2)…
Q: c# Now, modify the program so that the major functions appear in the following individual methods:…
A: modify the program so that the major functions appear in the following individual methods: GetMonth…
Q: Make sure each program has at least one method in addition to its driver method(main). Or use one…
A: import java.util.Scanner; public class Main{ public static void calculateEnergy(double m) {…
Q: The names of methods should begin with a(n) ____. a. verb b. noun c. adjective d.…
A: Noun :- Is generally present person, place, things. As in object oriented programming class…
Q: construct 2 methods: Void input() and void maxNum(). The input method should allow user to input 3…
A: if statement evaluates whether an expression is true or false.
Q: Use python, import sys, sys.argv to create a program called classname.py. The program should define…
A: please see the next step for solution
Q: list the arguments for the above call list the return type of sum here ______________
A: 1 public static int sum(int x, int y){ 2 int z = x +y; 3 return z; 4 } 5 public…
Q: e a python program to display the greater number between 2 numbers. The numbers are given by user.…
A: Below the python program to display the greater number between 2 numbers. The numbers are given by…
Q: Learn C# beginner programming - Simple code - Im stuck on the Date format. Im creating a int for…
A: DateTime class: The DateTime is a class that is used to print the date and time in different…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: import java.util.Scanner; public class DebugFive3 { // DebugFive3.java // Determines…
Q: Assume you are working as a developer in a bank, and you have been asked to develop a program to…
A: Editable source code: #include <iostream>using namespace std; int main(){ int n; char…
Q: 1, Write a java program named Suansu , define two integer variables A and B, initialize a to 10 and…
A: CODE: Suansu.java public class Suansu { private int A; private int B; //…
Q: Q1 \ write program in C# language to find the average of student marks in three subjects…
A: First, we will input the marks in 3 subjects. Then we will call the function avg_no. This function…
Q: FOR ALL PARTS, MAKE SURE YOUR METHODS ARE STATIC O PART 1: Method with Output O Define a method…
A: class MethodPractice{ public static void printHelloworld() {…
Q: Insfruction: Create a flowchart and a java program of the problem stated as follows. Create…
A: The complete JAVA code is given below Comments are also added to code The flowchart is given…
Q: Q7. Write a program on value passing from one method to another and also write separate programs for…
A: Value passing from one method to another: Values in a method can be passed to another in terms of…
The output of the program is:
Your integer is 100
Your integer is 300
Your integer is 100
QUESTION
b) Explain why the value of numOne is still 100 at line 11 after passing it to method tripleInt() at line 9
c) Which syntax(s) need to modify for the value of numOne to be 300 after passing it to method tripleInt() at line 9? [Identify the line code and write the correct syntax(s)]
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images
- public class worksheet3_1 { public static void main(String[] arg) { ShadowingExample example = new ShadowingExample(); example.x = 99; example.sampleMethod(); }}class ShadowingExample { int x; public void sampleMethod() { int x = 0; System.out.println("the value of local variable x = " + ………………………………………………); System.out.println("the value of instance variable x = " + …………………………………………); }} what should be written in the second print statement so that the output is: the value of instance variable x = 99 what should be written in the first print statement so that the output is: the value of local variable x = 0 options are: samplemethod.x this.x shadowingexample.x x Answer 1 Question 1The Body Mass Index – BMI is a parameter used to measure the health status of an individual. Various BMI values depict how healthy or otherwise a person is. Mathematically BMI = weight ÷hight×hight Write a java program using either JOptionPane or Scanner to collect the following values of an individual: i. Name ii. Weight iii. Height Major Topic Getting user inputs B.) Compute the BMI of that individual Make the following decisions if: i. BMI < 18.5 is under weight ii. BMI >=18.5 but =25 but = 30 but = 40 Morbid Obesity d)Display the results of the individualpublic static class Lab2{public static void Main(){int idNum;double payRate, hours, grossPay;string firstName, lastName;// prompt the user to enter employee's first nameConsole.Write("Enter employee's first name => ");firstName = Console.ReadLine();// prompt the user to enter employee's last nameConsole.Write("Enter employee's last name => ");lastName = Console.ReadLine()// prompt the user to enter a six digit employee numberConsole.Write("Enter a six digit employee's ID => ");idNum = Convert.ToInt32(Console.ReadLine());// prompt the user to enter the number of hours employeeworkedConsole.Write("Enter the number of hours employee worked =>");// prompt the user to enter the employee's hourly pay rateconsole.Write("Enter employee's hourly pay rate: ");payRate = Convert.ToDouble(Console.ReadLine());// calculate gross paygrossPay = hours * payRate;// output resultsConsole.WriteLine("Employee {0} {1}, (ID: {2}) earned {3}",firstName, lastName, idNum,…
- The Body Mass Index – BMI is a parameter used to measure the health status of an individual. Various BMI values depicts how healthy or otherwise a person is. Mathematically BMI = weight over height times height Write a java program using either JOptionPane or Scanner to collect the following values of an individual: a) i. Name ii. Weight iii. Height b) Compute the BMI of that individual c) Make the following decisions if: i. BMI < 18.5 is under weight. The Body Mass Index – BMI is a parameter used to measure the health status of an individual. Various BMI values depicts how healthy or otherwise a person is. Mathematically BMI = Write a java program using either JOptionPane or Scanner to collect the following values of an individual: a) i. Name ii. Weight iii. Height b) Compute the BMI of that individual The Body Mass Index – BMI is a parameter used to measure the health status of an individual. Various BMI values depicts how healthy or otherwise a person is. Mathematically BMI =…Please make a the following programs into one. class Main { static void number(int num) { if (num < 17) { return; } else { System.out.print(num + " "); // call function recursively number(num - 1); } } public static void main(String[] args) { Main r1 = new Main(); int num = 25; r1.number(num); class Main { static void number(int num) { if (num < 9) { return; } else { System.out.print(num + " "); // call function recursively number(num - 2); } } public static void main(String[] args) { Main r1 = new Main(); int num = 25; r1.number(num); }} class Main { static void number(int num) { if (num > 18) { return; } else { System.out.print(num + " "); // call function recursively number(num + 2); } } public static void main(String[] args) { Main r1 = new Main(); int num = 2; r1.number(num); }} class Main { static void number(int num) { if (num >…Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 3. Given the following code, the output is __. class Base { private int x = 5; }class Derived extends Base { x = 6; }public class Sample { public static void main(String[] args) { int x = 7; Derived d1 = new Derived(); System.out.print(d1.x); }} A. 0B. 5C. 6D. 7E. Error message Part 2 - 4. A class Animal has a subclass Mammal. Which of the following is true? A. class Animal extends Mammal { }B. class Mammal extends Animal { }C. class Animal implements Mammal { }D. class Mammal implements Animal { }E. class Mammal { Animal a1 = new Animal(); }
- // SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of a supermarket. The report lists total hours for // each day of one week. // Input: Interactive // Output: Report. import java.util.Scanner; public class SuperMarket { public static void main(String args[]) { // Declare variables. final String HEAD1 = "WEEKLY HOURS WORKED"; final String DAY_FOOTER = " Day Total "; // Leading spaces are intentional. final String SENTINEL = "done"; // Named constant for sentinel value. double hoursWorked = 0; // Current record hours. String hoursWorkedString = ""; // String version of hours String dayOfWeek; // Current record day of week. double hoursTotal = 0; // Hours total for a day. String prevDay = ""; // Previous day of week. boolean done = false; // loop control Scanner input = new…1) The UsingMethod class consists of a main method and a method called xMethod. What will the code print? public class UsingMethod {public static void main(String[] args) {double z = xMethod(3.5, 5.5);System.out.println(z);}public static double xMethod(double x, double y) {return x + y;}} 2) Identify the errors in the following programs a) 3 errorspublic class Test {public static void main(String[] args) {System.out.println(method2(3.4));} public static int method1(int n) {if (n > 0) return 1;else if (n == 0) return 0;else if (n < 0) return -1;}} b) 2 errorspublic class Test {public static void main(String[] args) {nPrintln(5, "Welcome to Java!");}public static void nPrintln(String message, int n) {for (int i = 0; i < n; i++) {System.out.println(message);}return n;}}The Body Mass Index – BMI is a parameter used to measure the health status of an individual. Various BMI values depicts how healthy or otherwise a person is. Mathematically BMI = WEIGHT/ HIEGHT * HEIGHT Write a java program using either JOptionPane or Scanner to collect the following values of an individual: 1.a. Namea b. Weight c. Height 2. Compute the BMI of that individual 3. Make the following decisions if: a. BMI < 18.5 is under weight b. BMI >=18.5 but <25 considerably healthy c. BMI >=25 but <30 overweight d. BMI >= 30 but <40 Obesity e. BMI >= 40 Morbid Obesity 4. Display the results of the individual 5. Explain your answer
- Please help me in fixing the errors in this java program. Then proceed in putting graphics like in the photos below Program is below // A simple program to demonstrate // Tic-Tac-Toe Game. import java.util.*; public class Main { static String[] board; static String turn; // CheckWinner method will // decide the combination // of three box given below. static String checkWinner() { for (int a = 0; a < 8; a++) { String line = null; switch (a) { case 0: line = board[0] + board[1] + board[2]; break; case 1: line = board[3] + board[4] + board[5]; break; case 2: line = board[6] + board[7] + board[8]; break; case 3: line = board[0] + board[3] + board[6]; break; case 4: line = board[1] + board[4] + board[7]; break; case 5: line = board[2] + board[5] + board[8]; break; case 6: line = board[0] + board[4] + board[8]; break; case 7: line = board[2] + board[4] + board[6]; break; } //For X winner if (line.equals("XXX")) { return "X"; } // For O winner else if (line.equals("OOO")) {…THIS NEEDS TO BE DONE IN JAVA Modify the Account class to provide a debit method that withdraws money from an Account. Ensure that the debit amount does not exceed the Account's balance. If it does, the balance should be left unchanged and the method should print out a message indicating "Debit amount exceeded amount balance." Modify class AccountTest to test method debit. Below are links to the Account and AccountTest programs. //This is for the account class public class Account {private String name; //instance variableprivate double balance; //instance variable//Account constructor that receives two parameterspublic Account(String name, double balance){this.name = name; //assing name to instance varialbe name//validate that the balance is greater than 0.0; if it's not,//instance varisble balance keeps its default initial value of 0.0if (balance > 0.0){ //if the balance is valaidthis.balance = balance; //assign it to instance variable balance}}//method that deposits (adds)…Use Java Assume the following Box class: public class Box { private double length; private double width; private double height; Box(double l, double w, double h) { length = l; width = w; height = h; } double volume() { return length * width * height; }} 1. Write a statement to instantiate a Box object, blueBox, with a length of 6, width of 4 and height of 2 .2. Write a statement to output the volume of the blue box .3. Write an additional constructor to class Box for a cube, which has only one parameter, side. Do not add any instance variables .4. Write a statement to instantiate a cube with a length of 3, width of 3 and height of 3 .