What will be the output of the following line of code? void show(); int main() { show(); printf("ARGENTINA "); return 0; } void show() { printf("AFRICA ");
Q: Write a program to calculate the total final marks for a subject. There are four assessment types…
A: Here is the c program of above problem. See below steps for code.
Q: can you help me complete the method huffmantoText and texttoHuffman public static void…
A: Below i have answered:
Q: what is the output?? class practice { static short type; public SuperTest(int a)…
A: According to the Question below the Complete Solution:
Q: .3.2: Basic class use. Print person1's kids, call the incNumKids() method, and print again,…
A: Java The JavaTM Programming Language is an object-oriented, concurrent, deeply typed,…
Q: What is the output of the following code? public class Parent { public void print() {…
A: OOP stands for object-orientated Programming. In Java, OOP helps us write DRY(don't repeat yourself)…
Q: Test the validity of each of the following arguments. Construct a formal proof of validity for the…
A: answers are given below
Q: Courses Review and Tix the errors in the following code segment. public Task1 { public void…
A: Given code: public Task1{ public void main(Strinng[] args) { x=5; int y=5.0; int…
Q: java to write a method that calculates the average
A: The objective of the given problem is to compute the Batting average in double and return it by the…
Q: Modulo 26 Arithmetic In this part of the project, we will learn what is arithmetic and linear…
A: a +m b means we will add a and b and then perform modulo division on the result of a+b via m. a .m b…
Q: print ("my name is" ,"tsion" "i am 27 years old") print ("i want becoming programmer") print…
A: The answer is
Q: Suppose dict1={ "brand" : "ford", "model": "focus"}, how will you access the brand using get()method…
A: Syntax to get values of dictionary DictionaryName.get("key")
Q: ython Programming: Write a program using unittest.TestCase methods to confirm that the addition and…
A: Lets see the solution.
Q: When performing a proof by induction, which is the case that is trivially true? the basis the…
A: Please find the answer below :
Q: class Exam { public static void main(String[] args) { X x = new X(); System.out.printIn(x.value); }…
A: Answer : Option a Explanation : In the given code we are trying to create instance of public…
Q: What is the output and how to fix this code to get "swing swing 10" as an output
A: Step 1:- Given Program:- package rope; public class Rope { public static int LENGTH = 5; static…
Q: The pseudocode generated in the method design Which is correct? A. can be used for actual coding…
A: Pseudocode is an artificial and informal language that helps programmers develop algorithms.…
Q: Can you tell me where the graphic code portion and how can I alter to make it just ask about…
A: The graphics code portion is Highlighted in the below code import java.util.*; import…
Q: Write a program in Java to compute the highprice and lowprice of a stock using the following…
A: Please find the answer below
Q: In software development, what is the difference between V&V and V&V? There must be some differences…
A: Validation: Validation is the process of evaluating the final product to check whether the software…
Q: 1. What is the output of the following code? Explain. class Super { public void show() {…
A: Output : Sub::show() called Explanation: Because we are assigning sub call object to Super class…
Q: The Monty Hall game is a statistical problem: there is a TV show (like the Monty Hall show) that…
A: a. win=0;loss=0;game=1;while game < 31 fprintf(['Game: ',num2str(game),'\n']) car =…
Q: Below is a method intended to modify the input array by doubling each element and a main method that…
A: The given method does not return anything since there is not return statement simply a is assigned…
Q: Assignment 1. Code-Tracing • Without running / testing the following code, predict what the…
A: The python code is
Q: The approximate word is when the value on the left of th word is equal to the total value on the…
A: Here I have created the function named balanced(). In this function, I have used 2 different loops…
Q: Match the proper method with the objective System.out.printIn("a"); [ Choose ] Print the letter a;…
A: Given: Two method of java which are as follows: 1. System.out.println( ) 2. System.out.print( )…
Q: Create a java program allowing the students to enter and display all their grades for each subject…
A: Code in java: import java.util.Scanner; public class JavaExample { public static void…
Q: QUESTION 21 Given the following code, what is the output? class Base { public void showO {…
A: Inheritance is a feature of object oriented where derived class uses features of patent class.
Q: Implement a C++ program to develop a class Library. Library contains pile of books as array and each…
A: Programming approach Creating a Class Library which contains the following private data members:…
Q: Designing an electronic voting machine is a challenging task. You are asked to implement a very…
A: the answer is given below:-
Q: NAME: Fibonacci Using methods, write a syntactically and semantically a correct Java program in the…
A: Java program to solve the given problem is below.
Q: Examine the code snippet below, and indicate what are the parameters? int result = Sum(5,6,7); ..…
A: Parameter: A parameter is a named variable passed into a function. Parameter variables are used to…
Q: 9. What is the length of the following array: byte[] data = { 12, 34, 9, 0, -62, 88 }; 10. What…
A: We are supposed to answer 1 question at a time, So I am solving the 10th question with the help of…
Q: reate a simple 2 player box game in Java. The game must implement the techniques discussed in the 2…
A: It is defined as a general-purpose computer programming language that is concurrent, class-based,…
Q: Please do this in Python Programming Scenario As you probably know, Sudoku is a number-placing…
A: Answer: I have given answered
Q: c) What is the output of the below java program? class Sweet{ void price(){…
A: lets analyse the given code for output: class Sweet{ void price(){…
Q: 11. Common Military Alphabet Phrases Create a building blocks of statements to display these phrases…
A: All we need to do is to print these 10 statements on the computer screen. We can use printf()…
Q: How to attempt? Question : The Card Game One day, Fred and his N friends were playing a card game in…
A: Input Specification: input1: An integer N denoting the number of cards(1<=N<=500) input2: An…
Q: ASSIGNMENTS: Question 1: Given: enum cropType {WHEAT, CORN, RYE, BARLEY, OATS}; сгopТуре crop:…
A: a is true static_cast<int>(WHEAT) is 0
Q: Select the correct output for the below program public class thisClass { public static void…
A: As soon as we run the code, there will occur an error. Because of undefined character '@'. The…
Q: In cricket, the overweight consisting of six bowls from th end. Create a task that takes the number…
A: Given total number of balls thrown n To get total number of balls thrown in last over, dividing it…
Q: (3-) Tony has succeeded in all his previous projects. Tony is (very delighted) to do another…
A: The Answer is given below step.
Q: This is a java question code give me the explanation with output (explanation is must with output
A: Here we have parent class called Base and child class called Derived. The class Base has a method…
Q: QUESTION 2 Write a Java program corresponding to the following algorithm. 1. Get the name of a…
A: The complete solution is given below:-
Q: what is the output? public class practice { public static void main(String[] args) {…
A: Define class Practice. Define main function. Access object for childclass and call function tryThis.…
Q: Read the following code and select the correct output. Linel: public class Foo { public void…
A: Please give positive ratings for my efforts. Thanks. ANSWER Here, according to the given…
Q: Make a program to add the selected product and the entered quantity in jTable. If the product is…
A: The program is in the next step
Q: The image below is the assignment, and above that is the code written to solve it... Please explain…
A: The given program takes user input for salary as double type. It maintains an array of 9 size that…
Q: How do I fix the output? Code output: Movie: [ Minutes 142 | Movie Name: The Shawshank Redemption…
A: Algorithm: for (initialExpression; testExpression; updateExpression){ // body of the…
Step by step
Solved in 2 steps with 1 images
- Java: ShowStudent.java: class ShowStudent { public static void main (String args[]) { Student pupil = new Student(); pupil.setIdNumber(234); pupil.setPoints(47); pupil.setHours(15); pupil.showIdNumber(); pupil.showPoints(); pupil.showHours(); System.out.println("The grade point average is " + pupil.getGradePoint()); } } ShowStudent2.java: class ShowStudent2 { public static void main (String args[]) { Student pupil = new Student(); pupil.showIdNumber(); pupil.showPoints(); pupil.showHours(); System.out.println("The grade point average is " + pupil.getGradePoint()); } } Student.java: class Student { // the private data members private int idNumber; private int hours; private int points; // Constructor added in part c Student() { } // end of constructor added in part c // the public get and set methods public void…Question public class MyProgram { if (h 18) { public static void main(String[] args) { int h=10, t-22; System.out.print ("Good "); } } else } } What is the output displayed by the following lines of code?" System.out.print ("Morning"); t = t + 2; if (t > 30) System.out.println(" Every one!"); System.out.println("The Your answer system.out.print("Evening"); t = t + 5; temperature is " System.out.println(" Brink water?"); Degree.");class Output{public static void main(String args[]){Integer i = new Integer(557);float x = i.floatValue();System.out.print(x);}} What will the given code prints on the output screen.
- In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Set the length of the rectangle to 24 and the width to 30.In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Print out the area of the rectangle.In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Declare an instance of rectangleType.
- public class StairViewer public static void main(String(] args) // Step 2: Create a rectangle and draw it as the // top step of the stair // location: (20, 10) // size: (20, 20) 18 // Step 3: Create a rectangle and draw it as the 19 // middle step of the stair 20 // location: below the top step, aligned on left // size: (40, 20) 21 22 23 24 // Step 4: Create a rectangle and draw it as the 25 // bottom step of the stair 26 // location: below the middle step, aligned on left // size: (60, 20) 27 28 29 30 } 31 32public class Geometry{public static void main(String[] args){//asks for user's choice Scanner in = new Scanner(System.in);displayMenu();selectOption(choice);System.out.println("Enter your choice (1-3): ");int choice1 = in.nextInt();System.out.println("Thanks for using the Geometry Calculator - Goodbye!");//Prints if input is a number that is not one of the choiceswhile(choice1 < 1 || choice1 > 3 ){System.out.println("Invalid choice. Please enter 1 - 3: ");choice1 = in.nextInt();}}/**Displays the menu*/public static void displayMenu(){System.out.println("Welcome to the Geometry Calculator Application");System.out.println("1. Calculate the Area of a Circle");System.out.println("2. Calculate the Area of a Rectangle");System.out.println("3. Calculate the Area of a Triangle");}/** This method calculates the area of the circle@return the area of the circle*/public static double circle()// calculates the area of the circle{Scanner in = new Scanner(System.in);System.out.println("What is…Transcribed Image Text JAVA Programming Problem: In the game of "Assassin's Creed", you control a ship with a cannon which is attacking a large enemy Assassin's Creed, armed with many guns. Your goal is to destroy as many of the guns as possible. The battle field is a 2D Cartesian grid, where your cannon is located at the origin. The enemy Assassin's Creed is a horizontal line segment located from the coordinates (X1, Y) to (X2, Y). There are exactly (X2 - X1 + 1) guns on the ship, located at the integer points (X1, Y), (X1+1, Y), ..., (X2, Y). However, the problem is, you cannot always fire at a gun. There are supernatural rocks located at all points of the battlefield whose X and Y coordinates are both integers. In order to fire successfully at an enemy's gun, the line connecting your cannon and that gun must not go through any rocks. Develop a JAVA code to output the number of the enemy battleship's guns that your cannon can destroy. Test Case Result 1 2 2 -2
- class Param3 { public int x; private void increase(int p) { x = x*p; } public void calculateX(int y) { increase(y); } public int getX() { return x; } } // in another class Param3 q3 = new Param3(); q3.x = 5; q3.calculateX(7); System.out.println(q3.getX()); what would be the answer for the last two lines ? also above were x = x*p do both x in here are the fields? wouldn't that be cnofusing?Understand the program code below and answer the following questions. class shape { protected int length, width; void set (int a, int b){ length = a; width = b; } void show () { System.out.println(length+” “+width); }} class rectangle extends shape { int area; void setArea(){ area= length*width;} void show () { System.out.println(area); }} class AreaRec{ public static void main(String [] args) { rectangle r= new rectangle(); Set(4,10); Show(); SetArea(); r.Show();}} 1.Identify the output of the program above. Please show the tracing table. 2. Identify the subclass and superclass. 3.Create other class named Triangle that inherits the properties from the superclass. Calculate the area of Triangle in instance method and instantiates object for Triangle class accordingly in main class. 4. Identify TWO (2) data members and TWO (2) functions members in superclass that maybe called in main function 5. Change shape as an abstract class and change method show as an abstract…public static void printIt(int value) { if(value 0) { } System.out.println("Play a paladin"); System.out.println("Play a white mage"); }else { } }else if (value < 15) { System.out.println("Play a black mage"); System.out.println("Play a monk"); } else { public static void main(String[] args) { printit (5); printit (10); printit (15); Play a black mage Play a white mage (nothing/they are all printed) Play a paladin Play a monk