Java program with the following: A constructor to assign values to the variable and the array. All values should be entered by the user through the keyboard.
Q: Write a java program ( One class with a main method ) to do the following : 1. Prompt the user to…
A: Actually, java is a object oriented programming language. It is a platform independent. It is a high…
Q: Write a JAVA program to create an array of objects of a class student. The class should have field…
A: Java is a programming language. It contains extensive libraries (package). It can be used to create…
Q: Write a function inside ProblemSolution class whose return type is void, accepts an array and the…
A: Solution :
Q: Write a java programe named counter that ask the user to enter 12 real numbers and store them in an…
A: The Scanner class of java.util package gives you methods like nextInt(), nextByte(), nextFloat()…
Q: Create a Java software that takes a character entered by the user and converts it to all capital…
A: Algorithm: Start Read array size n Read n characters and store them in an array Iterate through the…
Q: I need help with this program in Java not C++ only java program, a word search puzzle, where one is…
A: import java.util.Scanner;import java.io.IOException;import java.nio.file.Files;import…
Q: Write a Java Program to implement Polymorphism using method overriding. Use a sum function which…
A: class AddTwoInteger{ public void sum1(int n, int m) { int sum= n+m;…
Q: mplement a class Quiz that implements the Measurable interface. A quiz has a score and a letter…
A: Measurable.java/** * Describes and class whose objects can be measured */ public interface…
Q: Write a Java program to do the following task: Create an integer array of size 15. Input the values…
A: PROGRAM CODE: import java.util.*; // import utility package for javapublic class Main{…
Q: Write java program with a class whose instances represent a single playing card from a deck of…
A: java is a object oriented programming language. It is a platform independent.
Q: Write Java statements that do the following: Declare an array alpha of 20 columns and 10 rows of…
A: Statements: Declare an array alpha of 20 columns and 10 rows of the type int. int[][] alpha=new…
Q: Create a program in Java that implements Polymorphism and asks the users input to compute the wages…
A: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 import java.util.Scanner; class…
Q: Write a complete Java program that will require the user to input integer values in a 2 dimensional…
A: Java program to initialize 2D array and print the input value of the array
Q: The correct syntax for passing an array as an argument in a method is: (a) a[] (b) a() (c) a (d)…
A: The correct answer is : ( c ) a
Q: Write a java program using Encapsulation for the following class diagram. Get the values of name, id…
A: Student.java ======================= import java.util.Scanner; public class Student { //declaring…
Q: Write Program Java language Create an Animal class and an arraylist from that class you created.…
A: The code for Animal class is written below: class Animal{ // creating Animal class int…
Q: 1. Write a java program to find the 2nd largest number in the array. (2 marks) 2. What is…
A: 1. To find the second largest element of the given array, first of all, sort the array.Compare the…
Q: Write a Java program for the following scenario: Suppose we want to monitor the total revenue of…
A: program: import java.util.*;class property{ int property_id; String Location; int…
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: Write a Program in java Define an interface named Shape with a single method named area that…
A: Given : 1. Define an interface named Shape with a single method named area that calculates the area…
Q: Implement a class Quiz that implements the Measurable interface. A quiz has a score and a letter…
A: public static Measurable max(Measurable[] objects) { if (objects == null) return null;…
Q: Write a program with a class that contains an array of integers. Initialize the integer array in the…
A: /*Program to create an array class, with constructor, destructor and friend functions*/ #include…
Q: Write a Java program that creates and initializes an array of integers. Then create another array…
A: The mechanism of developing and implementing an executable computer program to achieve a particular…
Q: write java statement to shift the content of each cell of an integer array one place to the right,…
A: class RotateRight { public static void main(String[] args) { //Initialize array…
Q: Language: Java Write a class encapsulating the concept of daily temperatures for a week with a…
A: Actually, java is a object oriented language. using objects only implement the applications in java.…
Q: Is there a built-in JAVA method that accepts two arrays as parameters and returns true if both…
A: Introduction: Is there a built-in JAVA method that accepts two arrays as parameters and returns…
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: SOLVE WITH JAVA Q#1: Write the class Student having attributes name (String), age (int) and…
A: Program: import java.io.*;class Student{ int rollno; String name; int number_of_subjects;…
Q: 4. Given an integer array of size 10, write a Java program to prompt the user to enter an integer…
A: Given an integer array of size 10, write a Java program to prompt the user to enter an integer value…
Q: Write a method that returns the smallest element in the array that it takes as a parameter. (In the…
A: Initialize the first element as minimum and then for each element in array, compare and update if…
Q: 2. Implement the class billBook using the above UML: a. Write the constructor that takes as…
A: Here I written Java code for given problem. I hope you like it. with implements of billBook also…
Q: Write a java program using Encapsulation for the following class diagram. Get the values of name, id…
A: Encapsulation is an OOPs concept of wrapping the data member and method that acting on the data…
Q: Create a java program which validates whether a given array alternates between positive and negative…
A: The solution for the above given question is given below:
Q: Write a java program to complete the following parts: Part-1: Create a class Car and perform the…
A: Solution: Java Program: import java.util.*; /** * Part-1 * Create a class Car */ public class…
Q: Write a Java program that displays a shape representing capital letter of N as shown in the examples…
A: Here I have first of all asked the user to enter the size and then used if condition to check the…
Q: Write a Java program to do the following task :Create an integer array of size 15. Input the values…
A: Code:- import java.util.*;public class Main{ public static void main(String[] args) { Scanner sc…
Q: What is the problem with the followingfunction? static void testFunction(String title, int ... v,int…
A: Here the code consist of function testFunction which has three arguments title,v and y. Here the for…
Q: Write Java program for given scenarios below: Declare a class student with id, name and percentage…
A: one should not ask percentage. But still as per your requirement made java program. define one…
Q: Write a java program (One class with a main method) to do the following: 1. Prompt the user to enter…
A: Algorithm: 1.importing util package for scanner class 2.create object for scanner class to get…
Q: sing suitable rendering, you can assign different random colors -of course all of the colors are of…
A:
Q: For the first project, we focus on reviewing the basics of Java as you have learned in COMP 110.…
A: import java.util.*;import java.io.*;public class Main{ public static void main(String[] args) {…
Q: Create Java Program that ask the user to insert array length and then ask the user to insert array…
A: Algorithm : findAverage function : Step 1 : declare and initialize variables. Step 2 : use for…
Q: A A Java class can contain O Variables O Methods, Constructors Inner Classes (A class inside another…
A: A Java class can contain
Q: Step 1: Import Java classes Arrays, Random, and Scanner /** * A class to generate a random int array…
A: The exception, InputMismatchException is a java in-built exception class and it is in the java. util…
Q: Write a program to print the sum of two complex numbers by creating a class named as…
A: Program code: import java.util.*;import java.util.Scanner; public class ComplexNumbers { int…
Q: Java program, Create a class called Library with Accno, Callno, Title of the book, Author, Price of…
A: The java program will be created as follows: Create a class Library. Declare all the data members.…
Q: Write a program that uses two classes. The first class is called “dAta" and holds x and y…
A: Summary: -Hence, we have discussed all the points.
Q: Create a java program using user defined function. Create a function/method void: -showinfo with…
A: public class Main{ public static void showinfo(int A1, String FN, String LN, String MI, int A2)…
Write a Java
A constructor to assign values to the variable and the array. All values should be entered
by the user through the keyboard.
Step by step
Solved in 4 steps with 1 images
- 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 -2SOLVE IN "C#" Write c# equivalent statements for the following: There is a book library. Define classes respectively for a library. The library must contain a name and a list of books (use array). The books only contain author name as information. In the class, which describes the library, create methods to add a book to the library, to search for a book by a predefined author, and to delete a book from the library. Write a test class, which creates an object of type library, adds several books to it. Implement a test functionality, which finds all books authored by Stephen King and deletes them. Finally, display information for each of the remaining books.Problem Write a C++ program that will display multiple-choice trivia questions, accept the user's answers, and provide a full key and a score at the end. Question class Design and implement a class called Question. The Question class contains the following information: a stem (the text of the trivia question), an array of 4 multiple choice answers (the text of each possible answer) the letter of the correct answer (A, B, C, or D), called the key. This class will be used to represent trivia questions in a trivia game. The following operations should be available for Question objects (use the provided names). Construct a Question with no values (use empty strings for stem and answers and ‘X’ for the key). Construct a Question given its 3 components (). setStem: Set the stem question. getStem : Return the stem question. setAnswers : Set the 4 answers given an array. The answers will NOT include the letter (A, B, C, or D). getAnswer(i) : Return the single answer at index i. setKey: Set…
- Design a new class that contains a print and read function by creating a new object and calling the print and reading functions inside the case ( data structure in java)USING PYTHON 1. Write the PYTHON Programs for the following exercises 2. For each program, you need to write: Comments for all the values, constants, and functions IPO Variables Pseudocode Patient Charges Write a class named Patient that has attributes for the following data: First name, middle name, and last name Address, city, state, and ZIP code Phone number Name and phone number of emergency contact The Patient class’s _ _init_ _ method should accept an argument for each attribute. The Patient class should also have accessor and mutator methods for each attribute. Next, write a class named Procedure that represents a medical procedure that has been performed on a patient. The Procedure class should have attributes for the following data: Name of the procedure Date of the procedure Name of the practitioner who performed the procedure Charges for the procedure The Procedure class’s _ _init_ _ method should accept an argument for each attribute. The Procedure class should…USING PYTHON 1. Write the PYTHON Programs for the following exercises 2. For each program, you need to write: Comments for all the values, constants, and functions IPO Variables Pseudocode Employee Class Write a class named Employee that holds the following data about an employee in attributes:name, ID number, department, and job title.Once you have written the class, write a program that creates three Employee objects to hold the following data: Name ID Number Department Job TitleSusan Meyers 47899 Accounting Vice PresidentMark Jones 39119 IT ProgrammerJoy Rogers 81774 Manufacturing Engineer The program should store this data in the three objects, then display the data for each employee on the screen.
- MindTap: In C#, Write a program named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average. Test your function in your Main(). Tests will be run against Average() to determine that it works correctly when passed one, two, or three numbers, or an array of numbers.Java Programming Assignment 7.1 Using Java create an interactive (the user should be able to input the values) Java Application to process your utility bill for at-least 6 months. Use Class-Object methodology and use single dimensional arrays in your application. Write detailed comments in your program. You should have a two classes (for example, MontlyBill.java & MontlyBillTest.java). You can also be creative and create your “own problem scenario” and come up with your “solution”.Evaluating Postfix Expression The Postfix notation is used to represent algebraic expressions. The expressions written in postfix form are evaluated faster compared to infix notation as parenthesis are not required in postfix. We have discussed infix to postfix conversion in the class. Write a Java program that will input a valid postfix expression. The expression may accept a whole number or a real number. Every operand and operator should be separated by a space. Make sure to trap possible errors.Sample Output (Must be implement in GUI)
- Your task is to create two classes namely data and calculation. The calculation class is a friend of the data class. The data class will be composed of two floating point data members namely a and b. The class will also be composed of a friend function display that can display all the data members.1. Declare a class student with id, name and percentage 2. Make a public function average in class student which calculates the average student marks in 5 courses using arrays. 3. Define the object of class in main() 4. Get the values of studentlD, name and percentage from the user 5. Access method using class object and display average. 6. Print the values obtained from the user 7. Stop the program.Use Python Programming Language (The Stock class) Design a class named Stock to represent a company’s stock that contains: A private string data field named symbol for the stock’s symbol. A private string data field named name for the stock’s name. A private float data field named previousClosingPrice that stores the stock price for the previous day. A private float data field named currentPrice that stores the stock price for the current time. A constructor that creates a stock with the specified symbol, name, previous price, and current price. A get method for returning the stock name. A get method for returning the stock symbol. Get and set methods for getting/setting the stock’s previous price. Get and set methods for getting/setting the stock’s current price. A method named getChangePercent() that returns the percentage changed from previousClosingPrice to currentPrice. Write a test program that creates a Stock object with the stock symbol INTC, the name Inte lCorporation, the…