What will be the output of the following C# code? 1. static void Main(string[] args) 2. { int i = 2, k = 3; switch (i - k) 3. 4. 5. { 6. case -1: 7. ++i; 8. ++k; 9. break; 10. case 2: 11. --i; 12. ++k; 13. break; 14. default: 15. i += 3; 16. k += i; 17. break; 18. } Console.Writeline (i + "\n" + k); 19. 20. Console.ReadLine(); 21. ) 2 33 ) 3 2 3 ) 344 I) 5 10 10
Q: Consider the following C++ code: static long z = 5 ; int d = 10 ; int *ptr1 = new int[2] ;…
A: Given: Consider the following C++ code: static long z = 5 ; int d = 10 ; int *ptr1 = new int[2] ;…
Q: #include using namespace std; class Box { Public: int length, width, sum, sub, div; Box…
A: The given program is written in the c++ programming language. It can be executed in any one of the…
Q: In C#, how do you distinguish between an argument and a parameter variable?
A: Introduction: When a function is called, an argument refers to the values that were supplied to the…
Q: Task 4 Get Binary 2: Implement the get_bin_2 function as directed in the comment above the function.…
A: Approach: Suppose we are trying to represent the number 5 in binary. First, find the largest…
Q: Convert to C# Language def Deposit(balance, pin): # Deposit function…
A: This is C program that asks user to create the bank system criteria through programming. User will…
Q: Okay, I don't know what got into me but that was childish! Spamming someone is immature and does not…
A: 1. In function send Apology a. check if letter is 's' , 'o', 'r' or 'y' if yes…
Q: Hangman Game in C++ The instructions are in the pictures. This is what it is supposed to look like:…
A: Note: As you have not uploaded the randword.h and randword.cpp file, I am taking the example of two…
Q: #include #include int main() { printf("'This is my simple program’"); getch(); return 0;
A: Given: Required: output of the program:
Q: Static variables are often used: (a) in arithmetic expressions (b) to communicate between objects…
A: Actually, java is an object oriented programming language.
Q: include void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys",…
A: Explanation: The code defines two functions, fun1 and fun2, which have variable arguments. In the…
Q: Visual Studio 2019 how to loop this code in c# 8.0
A: The program given her is to do the conversion between the units(meter, kilometre, centimetre,…
Q: Ruby Programming: Write a function that takes a number x as a parameter and returns the value of…
A: Write a function that takes a number x as a parameter and returns the value of x2. Solution: Square…
Q: // FixedDebugFive04 // Program prompts user for any number of values // (up to 20) // and averages…
A: Algorithm: Start Declare an array of 20 numbers Initialize a constant integer QUIT to 999…
Q: Programming Language: C++ 1. A constant cannot be passed by reference. = true or false?
A: Explanation: a constant can be passed by reference in c++. Example: void swapNums(int &x, int…
Q: Please write a c program where the user will type in a text at the command line and the program will…
A: There are two types of comments in C A comment that starts with a slash asterisk /* and finishes…
Q: Translate the following C++ code to MIPS assembly language in Mars with
A: Writing MIPS assembly code is a common task for those who are working in computer science or related…
Q: Void Do1 (int: &, a. int &b) { a = 5; a = a + b; b = a + 2; } Int main() {…
A: We have given a C++ code and in which pass variable by reference. Here, integer variable x pass by…
Q: #include #include void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple",…
A: Include the necessary header files: stdio.h for input/output operations and stdarg.h for handling…
Q: T/F 1. Java interprets a negative value as false and a non-zero value as real, much like the other…
A: True, even in some cases the value 1 is considered as true. All the non-zero values are real and…
Q: Write a program that declares a variable named inches , which holds a length in inches, and assign a…
A: Here, as above program is concern 1st understand about Java and their programming concept. What is…
Q: For a lot of the scoring in this game, it is necessary to know the number of times that each number…
A: The ask is to construct two functions - a) for frequency count to determine the number of…
Q: c++ You are an IT Manager for a small company and must create a program to track your company’s…
A: PROGRAM CODE: main.cpp (code) #include <iostream>#include<vector>#include…
Q: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;) Dynamic…
A: Given: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;)…
Q: 1. class leftshift operator 2. 3. public static void main(String args[]) 4. 5. byte x = 64; 6. int…
A: ALGORITHM:- 1. Declare a byte variable x and assign value 64 to it. 2. Perform 2 bit left bit…
Q: ng. Each of these accounts has various options. For example, you may have a savings account that…
A: Banks offer a diverse range of account types to cater to the varying needs and preferences of…
Q: In C++ Find the five errors. For each error, state the line number, explain the error and show a…
A: Answer:)
Q: int func(int a, int b) { return (a<b)? a: b; } int main( ) { int x = 1, y = 3, z = 5; int w; w =…
A: Answer: 1
Q: Accumulating Totals in Single-Level Control Break Programs Summary In this lab, you will use what…
A: According to the information given:- we have to follow the instruction to get desired outcome.
Q: int j; switch (i) { case 0: j = 2*i; break; case 1: j = -i; break; default: j = -2*i;…
A: If i=1, then j will be -1. Because here i=1 which jumped to case 1 where j = -i => j = -1 then…
Q: Complete function RollSpecific Number() that has three parameters: a GVDie struct object, an integer…
A: The answer is given in the below step
Q: What is the difference between doGet() and doPost() in Servlet?
A: Both the doGet() and the dopost() functions are part of the HTTP protocol.Servlet classes process…
Q: The program should have a main method and another method called passwordChecker. The main method…
A: This is very simple. Here is the complete and correct Java code for the given problem. Note: The…
Q: C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error…
A: In this question you have to calculate monthly salary based on increment. and increment is only…
Q: Ruby Programming: Write a function that takes a number x as a parameter and returns the value of…
A: Write a function that takes a number x as a parameter and returns the value of x3 Test the function…
Q: COnvert to C# Language only def Deposit(balance, pin): # Deposit function p = int(input("Enter the…
A: using System;class HelloWorld { public static int Deposit(int balance, string pin) {…
Q: #include void main () { int a=5,b=10,c=1; if (a && b>c){ printf("cquestionbank") ; else{ break; } }
A: The keyword break is not a part of the if-else statement's syntactical form. As a consequence, the…
Q: Write a C program that reads the radius of a circle and prints its area and droumference ns:
A: in the following section we will learn about c program which will accept radius of circle as input…
Step by step
Solved in 2 steps
- Write in c##include void main () { int a=5,b=10,c=1; if (a && b>c) { printf("cquestionbank"); } else{ break; } }// 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…
- Kindly solve this C++ program and follow all the instructions! Please let me know how should I contact you for further assistance. Thank you for your help!Integer userValue is read from input. Assume userValue is greater than 1000 and less than 99999. Assign tensDigit with userValue's tens place value. Ex: If the input is 15876, then the output is: The value in the tens place is: 7 2 3 public class ValueFinder { 4 5 6 7 8 9 10 11 12 13 GHE 14 15 16} public static void main(String[] args) { new Scanner(System.in); } Scanner scnr int userValue; int tensDigit; int tempVal; userValue = scnr.nextInt(); Your code goes here */ 11 System.out.println("The value in the tens place is: + tensDigit);CREATE A FLOWCHART. Creating a Class in C++ // Rectangle.cpp using namespace std; class Rectangle { public: void setWidth(double); void setLength(double); double getLength(); double getWidth(); double calculateArea(); double calculatePerimeter(); private: double length; double width; }; void Rectangle::setLength(double len) { length=len; } void Rectangle::setWidth(double wid) { width=wid; } double Rectangle::getLength() { return length; } double Rectangle::getWidth() { return width; } double Rectangle::calculateArea() { return width*length; } double Rectangle::calculatePerimeter() { return (length+width)*2; }
- ? ParameterMysteryExam1 ♡ Language/Type: Java parameters return The following console program uses parameters and produces five lines of output. What are they? public class ParameterMysteryExam1 { } public static void main(String[] args) { String x = "java"; String y = "tyler"; String z = "tv"; String rugby = "hamburger"; String java = "donnie"; } hamburger (x, y, z); hamburger (z, x, y); hamburger ("rugby", z, java); y = hamburger (y, rugby, "x"); hamburger (y, y, "java"); and " + x + ” like + y); System.out.println(z + public static String hamburger (String y, String z, String x) { return z; } 9 M 31 mmport 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…C PROGRAMMING. #include <stdio.h>#include <stdbool.h>#include <stdlib.h> // BEGIN STRINGBUILDER IMPLEMENTATION // This code is a very rudimentary stringbuilder-like implementation// To create a new stringbuilder, use the following line of code//// stringbuilder sb = new_sb();//// If you want to append a character to the stringbuilder, use the// following line of code. Replace whatever character you want to// append where the 'a' is.//// sb_append_char(sb, 'a');//// Though there are some other functions that might be useful to you,// the driver code provided uses the functions, so there is no need// to use them manually. typedef struct { char** cars; size_t* len; size_t* alloc_size;} stringbuilder; stringbuilder new_sb() { stringbuilder sb; sb.cars = malloc(sizeof(char*)); *sb.cars = malloc(8*sizeof(char)); (*sb.cars)[0] = 0; sb.len = malloc(sizeof(size_t)); *sb.len = 0; sb.alloc_size = malloc(sizeof(size_t)); *sb.alloc_size = 8; return sb;} void…
- please fix what is wrong with the below C# code: using System; namespace Animals{ class Animals { public static bool CheckGuess(string animalType, string typeGuess) { static bool Main(string[] args, string animalType, string typeGuess) { if (String.Equals(animalType, typeGuess)){ return true; } return false; } string animalType = "Dog"; string typeGuess; int count = 0; bool result; Console.Write("Guess the animal: "); typeGuess = Console.ReadLine(); while(true){ count++; result = CheckGuess(animalType, typeGuess); if(result){ Console.WriteLine("You have Guess it Correct in " + count + " times.\n"); break; } else{ Console.WriteLine("You have Guess it Wrong " + count + " times!!\n"); Console.Write("Guess the animal again: "); typeGuess = Console.ReadLine();…C++ language pleaseC++ Help me fix my code please! I'm missing something and can't figure it out. Code and error picture are below. Original question is in the pictures too. #include <iostream>using namespace std; class Employee{ public: string first_name; string last_name; int monthly_sal; int increment; Employee() { first_name=""; last_name=""; monthly_sal=0; increment=0; } void setFirst_Name(string first_name) { this->first_name=first_name; } void setLast_Name(string last_name) { this->last_name=last_name; } void setSal(int monthly_sal) { if(monthly_sal<0){ this->monthly_sal=0; } else{ this->monthly_sal=monthly_sal; } } void setInc(int increment) { monthly_sal =monthly_sal+(monthly_sal*increment); } string getFirst_Name() { return first_name; } string getLast_Name() { return last_name; } int…