Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra" and "Zoe") and ages respectively. Assume also that stdin is a variable that references a Scanner object associated with standard input. Write some code that reads in a name and an age and then prints the message "The age of NAME is AGE" on a line by itself, where NAME and AGE are replaced by the values read in for the variables name and age. For example, if your code read in "Rohit" and 70 then it would print out "The age of Rohit is 70" on a line by itself. There should NOT be a period in the output.
Q: Given the declaration Circle x = new Circle(), which of the following statement is most accurate. a.…
A: EXPLANATION: In Java, an int is a primitive data type, but an Integer is a Wrapper class. The data…
Q: Q-No.5: Consider the following code and write the output of this code. (c) listStackType itsStack;…
A: Objective: A code segment is given on the generic stack data structure. Multiple operations like…
Q: nt("The letter is not a vowel") Based on the ordering of characters in the ASCII table, which of…
A: Option A: Vowel include A,E,I,O,U,a,e,i,o,u The code does not Prints “You entered a vowel” for…
Q: What is the output of the following code, assuming variables are declared and header files are all…
A: Program Approach: The header file “<iostream>” is declared that contains all standard…
Q: 6.13: Word Count Write a program that prompts the user to input the name of a text file and then…
A: Actually, program is an executable software that runs on a computer.
Q: In python -Once upon a time in the Land of Apples, John had three apples, Mary had five apples,…
A: The description is as- Taking 3 variables juan, maria, adan and storing 3,5,6 apples respectively.…
Q: This is a debugging question I am struggle with - The files provided in the code editor to the…
A: In "DebugTen1.java" file, The function name should be "main()", and not "mane()". The function…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: А Jаvа рrоgrаm саn be debugged simрly by right сliсking оn the Jаvа editоr сlаss file…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: 1. The first while-loop was not closed. 2. It will be java.lang.Math.random() instead of…
Q: he files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: import java.util.*; public class DebugSeven2 { public static void main(String[] args) {…
Q: What is the output of the unit testing? #include using namespace std; class TempConvert {…
A: Ans: the output of the unit testing is: #include <iostream>using namespace std; class…
Q: Write a program that computes the tax and tip on a restaurant bill for a patron with a $44.50 meal…
A: Answer:
Q: determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it…
A: Error Correction Reason while(day > DAYS); while(day > DAYS) After while loop, don't…
Q: Here is the question: The files provided in the code editor to the right contain syntax and/or…
A: public class Main{ public static void main(String[] args) { String quote = "Honesty is the…
Q: How many times will the value of the variable i be assigned the value 5 when the given code fragment…
A: The output of the program is shown by using comments in the next step.
Q: Give the declaration for two variables called count and distance. count is oftype int and is…
A: GIVEN: Give the declaration for two variables called count and distance. the count is of type int…
Q: A pedometer treats walking 2,000 steps as walking 1 mile. Write a steps_to_miles() function that…
A: The Answer is
Q: #include using namespace std; class Player { private: int id; static int next_id; public:…
A: Given, Code: #include <iostream> using namespace std; class Player { private: int id;…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: Debugging: There are some syntax errors and methods with wrong syntax. The corrections are pointed…
Q: Can you add class level comments, function level comments and inline comments In this line int…
A: In this line int I,n=0,s=0; they say the assigned value is not used can you fix that? I guess you…
Q: This is a debugging question I am struggle with - The files provided in the code editor to the…
A: Note : I have explained all the fixes made, in comments, right above the statements where the fix…
Q: Consider that there are two variables already declared with values a=10 and b-11. Which of the…
A: Initially, a=10 nd b=11 After completion of program a should be 11 and b should be 10
Q: Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra"…
A: C++ used to answer this question
Q: Assume the parameters in the following code are being passed by reference. What numbers reside in…
A: Pass by reference: Any changes made in the formal arguments will be reflected back to actual…
Q: #include using namespace std; class Player { private: int id; static int next_id; public:…
A: Coded using C++.
Q: the value
A: The value of the given program
Q: Create a program which will read a phrase from the user and create a framed version of it for…
A: 1.#Begin 2.Phrase = input("Please Enter a Phrase:\t") 3.Position = input("Please Enter the…
Q: This is a debugging question - The files provided in the code editor to the right contain syntax…
A: Given code: Errors: The semi colon is missing at the end of the statement at line number "5". The…
Q: #include using namespace std; class Player { private: int id; static int next_id; public: int…
A: The output of the given program is:- 1 2 3
Q: Data is stored in the following format: Here is a sample datafile. File: cars.txt…
A: According to the information given :- we have to create a java script file that read cars.txt file…
Q: How many times will the variable i be assigned a value when the given code fragment is executed? *…
A: Answer the above question are as follows:
Q: Please complete the following program fragment so that it pròduces the output given in the sample…
A: PROGRAM: import java.io.PrintWriter; import java.util.Scanner; import java.io.*; //Defining class…
Q: Write 3 different Python functions that can create the images given below. Code them in such so that…
A: #Function for black square with white hole square imagedef square(imgSize,factor): img =…
Q: Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra"…
A: Actually, string is a sequence of characters.
Q: This is the debugging problem. This is the question - The files provided in the code editor to the…
A: debugged program:- import java.util.*;public class DebugFive4{ public static void main (String…
Q: include using namespace std; class Player { private: int id; static int next_id; public: int…
A: Here have to determine about c++ code and output.
Q: Use the Bash shell for the completion of this project. Develop a shell scripting application that…
A: Given: Use the Bash shell for the completion of this project.Develop a shell scripting application…
Q: This is a debugging question I am struggling on - The files provided in the code editor to the…
A: public class DebugTen4{ public static void main(String args[]) { int id = 12241;…
Q: What is the output of the code segment below? for (int s = 1; s 0; t--) System.out.print(t + "…
A: A Java program that has the given statements is as follows, File name: “Main.java” public class Main…
Q: REUPLOAD: I need to fill the program to its designated output I have inserted sample runs and the…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
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: 2- Trace the following code and write the output: class Test1 { Test1(int x) {…
A: Here class Test1 has method Test1 having integer parameter x Class Test2 has method Test2 having…
Q: 5.write a program that initializes a String variable with "Welcome to Jac444!". Then, u methods of…
A: Java code to perform given question is given below.
Q: NEED A C++ PROGRAM CODE IN VISUAL STUDIO AND OUTPUT. Write a program in C++ that lets the user…
A: Write a program in C++ that lets the user enter some English text, then converts the text to…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- This is a debugging question - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code I was given - // A byte can't hold a value higher than 127 // This program throws an ArithmeticException // if adding two bytes yields a value that is too high public class DebugTwelve2 { public static void main(String[] args) { byte num1 = 120, num2 = 120, result; final byte HIGHBYTE = 127; try { allowed = (byte)(HIGHBYTE - num1); if(num2 > allowed) throw(new Arithmeticexception()); result = (byte)(num1 + num2); System.out.println("Result is + result); } catch(ArithmeticcException error) { System.out.println("Byte can't hold value higher than " + HIGHBYT); } } }This is a debugging question - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. You also will use a file named DebugEmployeeIDException.java with the DebugTwelve4.java file. Code I was given- public class DebugEmployeeIDException extends Exception { public DebugEmployeeIDException() { super(s); } } // An employee ID can't be more than 999 // Keep executing until user enters four valid employee IDs // This program throws a FixDebugEmployeeIDException import java.util.*; public class DebugTwelve4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String inStr, outString = ""; final int MAX = 999; int[] emps = new int[4]; for(x = 0; x < emps.length; ++x) { System.out.println("Enter employee ID number"); inStr =…Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Your program must contain at least the following functions: A function to read the students’ data into the array. A function to assign the relevant grade to each student. A function to find the highest test score. A function to print the names of the students having the highest test score. Your program must output each student’s name in this form: last name followed by a comma, followed by a…
- Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Your program must contain at least the following functions: A function to read the students’ data into the array. A function to assign the relevant grade to each student. A function to find the highest test score. A function to print the names of the students having the highest test score. Your program must output each student’s name in this form: last name followed by a comma, followed by a…This is a debugging problem - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. This is the code. I have fixed some of it but it still won't accept it - // Displays five random numbers between // (and including) user-specified values import java.util.Scanner; public class DebugSix4 { public static void main(String[] args) { int high, low, count = 0; final int NUM = 5; Scanner input = new Scanner(System.in); System.out.print("This application displays " + NUM + " random numbers" + "\nbetween the low and high values you enter" + "\nEnter low value now... "); low = input.nextInt(); System.out.print("Enter high value... "); high = input.nextInt(); while(low < high) { System.out.println("The number you entered for a high…REUPLOAD: I need to fill the program to its designated output I have inserted sample runs and the template of codes that will be used(?) Thank you! I TYPED DOWN THE CODE W/ THE PICTURE ATTACHED: import java. util. Formatter;import java. util. Scanner;public class Chupapi {private static Formatter output;public static void main (String[] args) throws Exception {output = new Formatter("output.txt");Scanner in = new Scanner(System.in);} // This method has one parameter and will return the string with all uppercase characters.public static String toUpperCase(String str) {// This method has one parameter and will return the number of vowels in the string.public static int countVowels(String str) {int numvowels = 0;return numvowels;}// This method has one parameter and Witt return true if the string is o pot indrome,// fotse if the string is not o potindrome.public static boolean isPalindrome(String str){boolean isReversible;return isReversible;}//This method hos three porometers and will…
- Write a program to test the Book class using C++. Create objects and use the print function in the objects to display information.Create an input text file that has the name input.txt with the following content. In Java please. 10 45 23 14 76 55 14 34 11 4 12What is the output of the unit testing? #include <iostream>using namespace std;class TempConvert { public: void SetTemp(int tempVal) { temp = tempVal; } int GetTemp() const { return temp; } TempConvert() { temp = 1; } int InFahrenheit() { return (temp * 1.8) - 32; } private: int temp;};int main() { TempConvert testData; cout << "Beginning tests." << endl; if (testData.GetTemp() != 0) { cout << " FAILED initialise/get temp" << endl; } testData.SetTemp(10); if (testData.GetTemp() != 10) { cout << " FAILED set/get temp" << endl; } testData.SetTemp(10); if (testData.InFahrenheit() != 50) { cout << " FAILED InFahrenheit for 10 degrees" << endl; } cout << "Tests complete." << endl; return 0;} a. Beginning tests. FAILED initialise/get temp FAILED InFahrenheit for 10 degreesTests complete. b.…
- Implement the FindText() function, which has two strings as parameters. The first parameter is the text to be found in the user provided sample text, and the second parameter is the user provided sample text. The function returns the number of instances a word or phrase is found in the string. In the PrintMenu() function, prompt the user for a word or phrase to be found and then call FindText() in the PrintMenu() function. Before the prompt, call cin.ignore() to allow the user to input a new string.Ex: Enter a word or phrase to be found: more "more" instances: 5This is a debugging question I am struggling on - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code - public class DebugCustomer { protected int idNumber; protected String name; protected double creditLimit; public DebugCustomer(int id, name, double creditLimit) { idNumber = id; name = name; creditLimit = credit; } public void display() { System.out.println("Customer # + idNumber + Name: " + name, "\nCredit limit $" + creditLimit); } } ----- public class DebugCustomerMakingPurchase extends DebugCustomer { private double amountOfPurchase; private boolean overLimit; public DebugCustomerMakingPurchase(int id, String name, double credit, double purchAmount) { amountOfPurchase = purchAmount;…The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. public class DebugBox { private int width; private int length; private int height; public DebugBox() { length = 1; width = 1; height = 1; } public DebugBox(int width, int length, height) { width = width; length = length; height = height; } public void showData() { System.out.println("Width: + width + " Length: " + length + " Height: "+ height"); } public double getVolume() { double vol = length + wdth + height; return vol; } }