What output does it produce? int funA(int x); void funB(int x); int main() { int a,b,c; a = 5; funB(a); b = 5; c = funA(b); cout<<a<<b<<c; return 0; } int funA(int m) { return m*m; } void funB(int n) { int d; d = n%2; cout<<n<<d; return; }
Q: Write a program in C++ that lets the user input an odd number of positive integers (space separated)…
A: Logic:- First take input from user , the number of elements and all elements. Apply check if n is…
Q: Multiples(): Takes an int (n) as parameter and prints first 10 multiples n in a single line using…
A: Introduction of Program: The Java program takes a number as input from the user and then the program…
Q: Prepare a program that can read the price (RM) of two books. Calculate and print the total price…
A: Java code: import java.util.Scanner; public class Main{ public static void main(String…
Q: Write a program in c ++ that inputs four numbers separated by spaces. The program should count how…
A:
Q: Write a program that generates a gradebook similar to the jenzabar grade book output: student name…
A: Note, as you haven't provided any programming language in the question so, I am using python…
Q: public static void main(String[] args) throws IOException{ BufferedReader b=new BufferedReader(new…
A: Answer: The given program accepts the instructor's salary and its academic rank then it prints the…
Q: Write a program in C that does the following. The program starts by offering the user the following…
A: // C program for the implementation of // menu driven program for student // management system…
Q: Write a C PROGRAM that computes and prints the area of a rectangle given its length and width. Your…
A: I give the code in C along with output and code screenshot
Q: C++ A robot is initially located at position (0; 0) in a grid [?5; 5] [?5; 5]. The robot can move…
A: The below given C++ program will obey the following rubrics: Including necessary header files.…
Q: Create an implementation of your Range abstract data type called WordRange. When you are finished,…
A: In the for loop of java the iteration work on list not object of the class so that's why showing…
Q: 2.18 LAB: Divide input integers Write a program using integers userNum and divNum as input, and…
A: Here is the code in Java:
Q: Q1) Find the output of the following Java application: public class Example{ public static void main…
A: We are going to write a println statement to print the followinng message The path of my file is:…
Q: Vrite a simple C program that can determine whether a machine is little- or big-endian. 2. Printing…
A: Answer: I have given answered in the brief explanation
Q: 1.1.2: Output variable value. АCTIVITY 283902.1889792.qx3zay7 Jump to level 1 Write a statement that…
A: import java.util.Scanner;public class InputExample{ public static void main(String args[]) {…
Q: 1. Find the statement that causes the compilation error. 2. Determine the output if that statement…
A: Here we have a class A with one method. Next, we have another class B that extends A and also has…
Q: Write an application in Java which defines String=”hello world”, convert it into character array…
A: code: import java.util.*; public class GFG { public static void main(String args[]) {…
Q: The instructions my prof. wants is this: Write a program that prompts the user for a binary number…
A: public class Main{ public static int getDecimal(String str) { int len = str.length();…
Q: Write the function parrotTrouble. *
A: Approach Create a public class named ParrotTrouble Define method parrotTrouble that returns true…
Q: Write a program in C++ that lets the user input an odd number of positive integers ( each separated…
A: Sample Output
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: Right code is: public class DebugSeven3{ public static void main(String[] args) { String quote =…
Q: Can you write a new code in Java language with the values I sent you, just like this output? There…
A: Actually, c++ is a powerful general language. It is a high level language.
Q: Control structures: In Java only please. Output the position of the largest number and the largest…
A: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: Arrays a1, a2… are populated as shown; display a[i] for each calls to arr; if a[i] less than or…
A: Declare and initialize the five arrays given in the question, as static. Inside the arr() method…
Q: Can you write a new code in Java language with the values I sent you, just like this output?…
A: Source code:- #include <bits/stdc++.h>using namespace std; int main(){ ifstream…
Q: can you help me get the expected output like what's on the photo. below is my source code in basic c…
A: The complete C code is given below along with screenshots We will create a Person object and…
Q: Write a pythonprogram that reads in a Python source code file and counts the occurrence of each…
A: CODE: #list of keywodskeywords =…
Q: In this java program please explain everyline of this code. Source Code: // Online Java Compiler…
A: The above java program is to find 1. Total iterations made 2. Sum of all iterations Initially, we…
Q: Write a program that reads a set of floating-point numbers and prints out the ten largest numbers.…
A: #include <iostream> using namespace std; int main(){ int size = 11; int i,j; double…
Q: 1. Determine the output for the following code. Box in your final output result. public class Beta…
A: Clearly, Beta is subclass which is inheriting superclass Baap Then we have overridden the…
Q: In c void f (int *p, int * const q) { p=q *p=3; *p=4; }
A: The pointer in C language is a variable which stores the address of another variable.
Q: he twins Kartik and Kunaal want to play word search puzzles with their class. They want to be faster…
A: • check all cells. If a cell has the first letter, we will then try all 8 directions one by one from…
Q: Please USE PYTHON Implement the design of the Pasta class so that the following output is…
A: 1) Below is python program to implement the design of the Pasta class so that the following output…
Q: (Random month) Write a program that randomly generates an integer between 1 and 12 and displays the…
A: Purpose: The main purpose of the program is that if we are entering a number then as each number…
Q: ISP-Java Write a program whose input is two integers, and whose output is the first integer and…
A: Given: ISP-Java Write a program whose input is two integers, and whose output is the first integer…
Q: What is the output of below C++ Code:- for(int i=2;i<=3;i++) for(int j=i;j<=3;j++) cout<<i<<"@"; A…
A:
Q: Code language Java 1, Add a print statement to say “Multiplication Table” and then prompt the user…
A: Lets see the solution in the next steps
Q: 2. Determine the output for the folwing code. Box in your final output result. public class Greek…
A: EXPLANATION: The definition of the main function includes the creates the objects of class Greek…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: The code has given
Q: Hello, I'm working on this hangman simulation in C++. The code runs but it doesn't count wrong…
A: #include <iostream> #include <cstdlib> #include <ctime> #include <string>…
Q: In JAVA A function foo takes three integers as input arguments, i.e., foo(int a, int b, int c). The…
A: A function foo takes three integers as input arguments, i.e., foo(int a, int b, int c). The three…
Q: This is part of my hangman simulation in C++. If you compile and run it and type "Easy," the code…
A: Answer:
Q: Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 1…
A: The correct JAVA code is given below with code and output screenshots
Q: Enter a string: KNOWPROGRAM Enter number of rows: 9 K N O W P R O GR A M K NO W PROGR A M KNO W PR O…
A: The Answer is
Q: // Assume all libraries are included void func(int a, // int main () { int i = 5, j = 4, k = 3; 3…
A: in func variable a is taken by value but b and c are taken by reference. so, whatever changes made…
Q: #include #include #include #include #include #include "card.h" #include "deck.h" #include…
A: Programming is a way to instruct the computer devices to operate. Every computer needs a set of…
Q: What is the scope of identifier Sum which is declared in Line 6? * Consider the following program:…
A: D) Line 6 to Line 9
Q: void func (__ ---){ *total = *x* *y; a. int *x, int *y, int *total O b. int &x, int &y, int &total O…
A: A function is basically a block of code that is used to do some computation. It has a return type.…
Q: TTTT Vrite a function in Java that implements the following logic: Given a number n, return true ifn…
A: Logic:- if n>=1 && n<=10 return true else if(outsideMode==true) If(n<=1 ||…
Q: Write a complete C++ program that contains the integer functions (main, funx and funy). The main…
A: #include <iostream> using namespace std; // defination for funxint funy(int n) { // since…
Q: a. Prompt the user to type a word on console and save the input into variable b. Implement recursive…
A: As per the given problem, we have to do the following : 1. Get a word as input from user. 2. Check…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- // 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…PROBLEM STATEMENT: Return the factorial of the provided integer parameter. public class FactorialComputation{public static int solution(int n){// ↓↓↓↓ your code goes here ↓↓↓↓return 0;} Can you please help me with the question above the Language is Java and can yiu use the java code that i gave above to answer the questioncan you help me get the expected output like what's on the photo. below is my source code in basic c language #include<stdio.h> typedef struct { int age;} Person; void displayPerson(Person); int main(void) { // TODO: Create a Person here and ask the user for its age return 0;} void displayPerson(Person p) { printf("PERSON DETAILS:\n"); printf("Age: %d", p.age);}
- PART A. Write a program NumberShape that asks the user to enter a single-digit number and outputs the results as shown below using that number. Here are two examples (with user input shown in red): Enter a single-digit number: ex: 4 4 4 4 44 44 44 4 44 import java.util.Scanner public class NumberShape{public static void main(String[] args){Scanner input = new Scanner(System.in);System.out.println("Enter a single-digit: ");int randomNumber = input.nextInt();System.out.println( randomNumber); System.out.println(randomNumber randomNumber);System.out.print( randomNumberrandomNumber randomNumberrandomNumber);System.out.println(randomNumberrandomNumber randomNumber randomNumberrandomNumber);} }Computer Science Title: Programming - Practical Test 1 - SET 3Learning Objective:Write simple Java programs using basic data types, operators and expressions.Write Java programs using control structures - Sequence Question:Prepare a program that can read the price (RM) of two books. Calculate and print the total price (RM) of the two books that includes 5% discount.. Based on the given problem, the student need to:i. Write the Java programii. Display the output[100% marks] Sample input and output:Input price of book 1 : 50.50Input price of book 2 : 90.90Total price : 141.4Discount : 7.07Net paymant : 134.33 help me please asap.You are required to implement a preprocessor in Java. Your preprocessor should be able to perform the following task:Identifying loops and methods Example of output: import java.util.Scanner public class String Scanner new Scanner(System.in) System.out.print.ln nextLine void
- 4.31 LAB: Months until payoff (JAVA) Write a program in java that reads a loan amount, payment amount, and interest rate as inputs and outputs the number of payments required until the loan is paid. Interest is added to current balance before a payment is applied. Ex: If current balance is $100.00 and the interest rate is 0.02, the new balance is $102.00 before a payment is applied. All values are doubles. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /* Type your code here. */ }}Extend to cast the double to an integer, and output that integer. Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 3.77 cast to an integer is 3 mport java.util.Scanner; public class BasicInput {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int userInt = 0;double userDouble = 0.0;// FIXME Define char and string variables similarlySystem.out.println("Enter integer: ");userInt = scnr.nextInt();// FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space// FIXME (2): Output the four values in reverse// FIXME (3): Cast the double to an integer, and output that integerreturn;}}Question: (Code must be in java language) Assuming that you have the functions “drawPolygon(int[] x, int[] y, int n)” for drawing polygon, “drawRectangle(int x, int y, int width, int height)” for drawing rectangle and “drawCircle(int xc, intyc, int radius)” for drawing circle; draw the given shape. Where: R(300,250), T1(325,275), T2(475,275), T3(400,400), P1(285,250), P2(225,275), P3(200,450), P4(285, 300), Q1(515,250), Q2(575,275), Q3(600,450), Q4(515,300)//Look attached image here Note: No need to write the definition of the methods, there are no marks for definition. Only use method calls to create the shape as shown in Figure 1.
- Finish the Java program: Code: import java.awt.Point; import java.util.Random; class Main { publicstaticvoid main(String[] args) { Point player1_location, player2_location; System.out.println("This program randomly generates (x,y) locations"); System.out.println("between 1-10 for two players, repeating until"); System.out.println("one of their coordinates are the same for both players."); do { player1_location = randomNewPlayerLocation(); player2_location = randomNewPlayerLocation(); System.out.println("Player1 location: (" + player1_location.x +"," + player1_location.y + ")"); System.out.println("Player2 location: (" + player2_location.x +"," + player2_location.y + ")"); System.out.println(); // DON'T CHANGE ANY OF THE ABOVE CODE }while( /* WRITE YOUR LOOP CONDITION HERE */ ); } // Generates random (x,y) coordinates between 1-10, then // returns a Point object with those coordinates. static Point randomNewPlayerLocation() { // WRITE YOUR FUNCTION BODY HERE } } Sample…4.34 LAB: Draw upside down triangle (JAVA) Write a program in java that outputs a right triangle of asterisks given the height as input. Each line ends with a blank space. Ex: If the input is: 3 the output is: * * * * * * Code starts here: import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /* Type your code here. */ }}I would like some help in java note: this question needs to be solved using only WHILE loop