4. What will be the output of the following C# code snippet? 1. { 2. try 3. { 4. int a, b; 5. b- 0; a = 10 / b; 6. 7. Console.Writeline("A"); 8. 9. catch(ArithmeticException e) 10. { 11. Console.WriteLine("B"); 12. } 13. Console.ReadLine(); 14. } a) A b) в c) Compile time error d) Run time error
Q: Show the printout of the following program:class A:def _ _init_ _(self):print("A's _ _init_ _()…
A: The given code defines two classes named "A" and "B". Class "A" defines the constructor with print…
Q: What will be the output of the following C# code? class A { public virtual void display() {…
A: Question. What will be the output of the following C# code? class A{public virtual void…
Q: What is the output of following piece of C# code? String s1 = "OBJECT_ORIENTED"; String s2; s2 = s1…
A: Answer is T_ORI s1 = "OBJECT_ORIENTED" s2 = s1 + "_ORIENTED" = "OBJECT_ORIENTED" + "_ORIENTED" =…
Q: Sample Run The following is a sample run of the program. You must change the wording of the text.…
A: Answer: Our Instruction is answer the first three part from the first the first part.
Q: Look at the following program and tell what it will output when run:public class…
A: Source Code: public class ExceptionTest{public static void main(String[] args){int number;String…
Q: What is the value of a after the code runs? What is the value of b after the code runs? You are…
A: Program Explanation: 1. Firstly, it calculates a a= 2*3*4 a=24 2. Calculate the value of b b= 24/3/4…
Q: If you forget to put a closing quotation mark (") on a string, what kind of error will be raised?
A: If you forget to put a closing quotation mark (") on a string, kind of error will be raised
Q: 2. public class Test2 { public static void main(String[] args) { for (int x=1; x < args.length; ++x)…
A: Given: public class Test2 { public static void main(String[] args) { for(int x=1;…
Q: est (int x = 0, int y = 0) { this->x = x; this->y = y; } Test setX(int a) { x = a; return *this; }…
A: When return a plain object rather than a reference, then returning a copy of the object on which…
Q: What would be the output...
A: In the above code there is no main method to process the data. In the Main method create an object…
Q: Question-13. What is the outcome of the below Java code? class TestApp { public static void…
A: Select right option
Q: in C# how would it be changed to use a for loop instead of a while loop to count to 1000?
A: for loop will have initialization, condition check, increment/decrement condition in the body itself…
Q: No loops
A: The program is explained in detail with inlined comments. It uses the substring function of the…
Q: using System; class Program { public static void Main(string[] args) { int number = 1; while…
A: The solution is given in next step
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: Trace through the following code by sight (not putting it into a program). What would be displayed…
A: In this question, A piece of code is given of C# That code follows the recursion Given: private int…
Q: What is displayed on the console when running the following program? class Test{ public static void…
A: Answer: class Test { public static void main(String[] args) { try { method();…
Q: Do it quick Give output of c# code. static void Main(string[] args) { int i = 2, k = 3;…
A: GIVEN: Do it quick Give output of c# code. static void Main(string[] args){int i = 2, k =…
Q: Which of the statements below is false about c#? A.The Program execution starts at the Main method…
A: Introduction: C# is a general-purpose, modern and object-oriented programming language pronounced as…
Q: What is the output should be ? class Mycpp int main() Мусрр obj: return 0; Select one: O a. Nothing…
A: Answer : A Reason: #include <iostream>using namespace std; class Mycpp{ };int main(){Mycpp…
Q: Show the printout of the following program:class A:def _ _new_ _(self):print("A's _ _new_ _()…
A: The given code defines two classes named "A" and "B". Class "A" defines the function "new()" and…
Q: What is the Output? public static void main(String[] args) { new…
A: Hello Student, Hope you are doing great in study and coding. Warm greetings from my side. I will try…
Q: if (int.TryParse(userInput, out flightNum)) { User = GetInfo(ID, Mobile, Name, Date, Address);…
A: Tryparse function is used to typecast values. int.Tryparse() converts string value into integer…
Q: Look at the following program and tell what it will output when run: public class ExceptionTest…
A: catch(NumberFormatException e) The exception raised when enter an other than integer value for the…
Q: When we execute this code what is its output? def main(x): def main1(): print ("Origional") x()…
A: Given, Code: def main(x): def main1(): print("Origional") x() return…
Q: What will be the output of the following code snippet?
A: I have given answer in step 2.
Q: using System; class Program { publicstaticvoid PrintBoard() { Console.WriteLine(" X | | ");…
A: Required: Hello! This program is in C# to play a simple tic tac toe game with the user vs. computer.…
Q: What is displayed on the console when running the following program? public class Test {…
A: Rule of try catch finally block 1) if any exception occur in try block then only catch block will…
Q: please fix what is wrong with the below C# code:
A: 1. In your code the checkGuess function should be separate from main function 2. Main function…
Q: The Scanner class .next() method will read
A: 1) The Scanner class .next() method will read:
Q: What will be the output of the following C# code snippet? class program { public static void…
A: 6. What will be the output of the following C# code snippet? class program{public static void…
Q: A(n) _____is a small application that cannot run on its own but can be used with other software…
A: There are mainly two types of software namely, system software and application software. The…
Q: using System; class Program { public static void Main(string[] args) { int number = 1; while…
A: Required: this code is written in C# to count from 1-1000. how can more code be added to this to add…
Q: In this assignment you will write a command interpreter in Python or Java. The user types a command…
A: while(1): print("Enter command") command=input() if(command.split()[0]=='LIST' or…
Q: The following code is in Java: // Assume inputFile references a Scanner object. try { input…
A: InputMismatchException in java is used to throw exception by scanner when input fails in matching…
Q: What will be the output of the following C# code? class A { public int i; public void display() {…
A: Question. What will be the output of the following C# code? class A{public int i;public void…
Q: What will be the output of below Python snippet? class A(): def disp(self):…
A: d) A disp()
Q: A programmer notices the following two procedures in a library. The procedures do similar, but not…
A: Given Procedure MaxTwo (x, y) returns the greater of its two integer parameters. Procedure MaxThree…
Q: IN JAVA Which XXX is needed for enterNumber() to read a value from standard input? public…
A: Which XXX is needed for enterNumber() to read a value from standard input? public int enterNumber()…
Q: What is the output of the given program below if FirstNumber = 10 and SecondNumber = 25? using…
A: Answer:
Q: What will be the output of the following java code? Bsblic class Main public, static void…
A: 1) Java program in question creates two Boolean variables b1 and b2 2) It compares b1 and b2 with…
Q: What will be the output for the given set of code? class A { public int i; public…
A: Question. What will be the output for the given set of code? class A { public int i;…
Q: 2. What is the output of the following progi ? namespace ConsoleApplication1 { struct TMA public int…
A: Arguments pass by reference: The "ref" is the keyword that can be used in the C# programming…
Q: this is my code about the Pig Latin Language. What did I do wrong, please? using static…
A: Introduction of the Program: The C# program takes a word from the user and then convert it into Pig…
Q: Start with the code below and complete the getInt method. The method should prompt the user to enter…
A: import java.util.*; import java.io.*; public class ReadInteger { public static void main(String[]…
Q: What will be the output of the following C# code? class a { public void fun() {…
A: Given: using System;class a { public void fun() { Console.WriteLine("base…
Q: lease modify my program so that the output will print like what is in the picture. Thank you in…
A:
Q: What is displayed on the console when running the following program? class Test{ public static void…
A: The Given program is class Test{ public static void main(String[] args){ try{ method();…
This is mcq
Step by step
Solved in 2 steps
- using System; class Program{ // Define PrintBoard method public static void PrintBoard() { Console.WriteLine(" X | | "); Console.WriteLine(" | | "); Console.WriteLine(" | O | "); Console.WriteLine(); } public static void Main(string[] args) { PrintBoard(); // Call PrintBoard method PrintBoard(); // Call it again PrintBoard(); // And again! }} This program is really simple and basic to print a tic tac toe board for the user to eventually play the computer in C#. How can it be modified a little bit to print the board and have each tile labeled with a number to identify the space? I'm a beginner and would like to take this step by step in modifying the code. Thank you!In this assignment you will write a command interpreter in Python or Java. The user types a command in response to a prompt that appears on the screen. When the command is entered, the command interpreter determines what the command means and executes the command. Your command interpreter should do the following. Display a prompt for the user. Read the user's input. Determine if the entered command is valid If it is valid, print a message that says the command is being executed and then re-display the prompt. If the command is not valid, display an appropriate error message and re-display the prompt. Continue until the user enters the command “QUIT”. The valid commands will be LIST (lists contents of current directory) LIST path (lists contents of the directory identified by path) CHDIR path (changes current directory to the directory identified by path) RUN path/filename (executes an executable file in path)…I have the following code; a lot of details are unclear; this is a Java code; please draw the CFG (Control Flow Graph); it should look something like this: this is the source code: private void function() { try{ var1 = something; var2 = something; var2.function2(1,param1. param2);var2.function2(2, param1. param2); var3 = something; if (var3 > 0) { statements; } else { statements;} }//end of the try catch (exception) {print; } // end of catch }//end of the function
- In Python: What gets printed by executing the following code? def teststrings():str1 = 'X University'str2 = 'Computer Science'print(str1[0].isupper()) #str3 = str1.replace("university',' ')str2+=' ' +str1print(str1)print(str3.rstrip())print(str2)def main():teststrings()main()this is my code about the Pig Latin Language. What did I do wrong, please? using static System.Console; class PigLatin { static void Main() { //Write your main here string enteredWord; string firstCharacter; string newWord; const string suffix= "ay"; //enteredWord = word entered by the user //firstCharacter= first letter removed //newWord= new version that Pig Latin will proved WriteLine("Enter a word: "); enteredWord = ReadLine(); firstCharacter = enteredWord.substring(0,1); enteredWord=enteredWord.remove(0,1); newWord=enteredWord+firstCharacter+suffix; WriteLine(string.concat(enteredWord,firstCharacter, "ay")); } }Write a program named InputMethodDemo2 that eliminates the repetitive code in the InputMethod() in the InputMethodDemo program in Figure 8-5. Rewrite the program so the InputMethod() contains only two statements: one = DataEntry("first");two = DataEntry("second"); using static System.Console; using System; class InputMethodDemo2 { static void Main() { int first, second; InputMethod(out first, out second); WriteLine("After InputMethod first is {0}", first); WriteLine("and second is {0}", second); } private static void InputMethod(out int one, out int two) { string s1, s2; Write("Enter first integer "); s1 = ReadLine(); Write("Enter second integer "); s2 = ReadLine(); one = Convert.ToInt32(s1); two = Convert.ToInt32(s2); } public static int DataEntry(string whichOne) { } }
- Write a C# program that asks the user to enter their name and age, and then prints a greeting message that includes their name and age. Your program should do the following: Ask the user to enter their name and age using the Console.ReadLine() method. Use string concatenation to create a greeting message that includes their name and age. Print the greeting message to the console using the Console.WriteLine() method. Provide the code for your program (the .cs file). Example output: Enteryourname:John Enteryourage:16 HelloJohn,youare16yearsold.JAVAI need a prompt and GUI that allows the user to log in as a teacher, the password for the teacher login should be "Teacher123" and once the user logs in, it should display to the user a grade book, using this code below. import java.util.Scanner;public class Teacher{ public static void main(String[] args) {System.out.println("Enter the number of grades that are going to be calculated of that subject: "); //input Scanner scanner = new Scanner(System.in);int cla = scanner.nextInt();double[] arr = new double[cla]; //Declaring array of elementsdouble total = 0; for(int i=0; i<arr.length; i++){System.out.print("Enter in grade #" +(i+1)+" : "); //input of the gradearr[i] = scanner.nextDouble();}scanner.close();for(int i=0; i<arr.length; i++){ total = total + arr[i];}double average = total / arr.length; //finding the total averageSystem.out.format("The average is: %.3f", average); //print from input}}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. This is the code I am having issues fixing - // Start with a penny // double it every day // how much do you have in a 30-day month? public class DebugSix1 { public static void main(String args[]) { final int DAYS = 30; double money = 0.01; int day = 1; while(day > DAYS); { money = 2 * money; ++days; System.out.println("After day " + day + " you have " + moneyAmt); } } }
- How do I make this program in C++? I've posted this before, but I've only gotten wrong answers. Problem Write a C++ program that will simulate a Change Password Utility. Your program will contain: One class, PasswordManager, that will manage a single password for a given username. A driver containing a main function that will allow the user to change their password. PasswordManager Class The PasswordManager class should have two member variables (both strings): a username an encrypted password. Do not store the password (in the class or in a text file) unencrypted! The PasswordManager class should have the following two internal member functions (not accessible outside of the class): encrypt: this takes a password (a string) and returns the encrypted form of the password. Note: there is no decrypt function (there is no need to decrypt passwords). We will use the following VERY simple encryption algorithm (a Caesar Cipher): For every character in the input string, add 37 to the…IN JAVA Which XXX is needed for enterNumber() to read a value from standard input? public int enterNumber() XXX{int value;value = System.in.read();return value;} A. import java.io B. throws SystemException C. nothing is needed D. throws IOExceptionHere is the question: Write an application that accepts three Strings from the user and displays them in alphabetical order without regard to case. Here is the code so far just needs to be altered: import java.util.*; public class Alphabetize2 { public static void main(String[] args) { String str1, str2, str3; Scanner in = new Scanner(System.in); System.out.print("Enter first string >> "); str1 = in.nextLine(); System.out.print("Enter second string >> "); str2 = in.nextLine(); System.out.print("Enter third string >> "); str3 = in.nextLine(); // display strings in alphabetical order if(str1.toLowerCase().compareTo(str2.toLowerCase()) < 0 && str2.toLowerCase().compareTo(str3.toLowerCase()) < 0) System.out.println("You entered the strings in alphabetical order"); else System.out.println("You did not enter the words in alphabetical order"); } }