public class StringRef { public static void main(String[] args) { int x-9; String s1 - "abc"; String s2 - "def"; String s3 = s2; s2 "ghi"; String sup ( x < 15) ? "smal1": "tiny"; System.out.println(s1 + s2.charAt(1) + s3.indexOf ('d')); System.out.println(sup.charAt (2));
Q: public class ArrayMerge { static void arrayMerge(int a[], int b[]){ int c[] = new…
A: Please find the solution below
Q: JAVA PROGRAMMING Please Help! Look over my code and explain to me what I'm doing wrong. Thank You!…
A: Here, I have to write a java code for the above question. The highlighted one is the modified code.
Q: public class Test { public static void main(String[] args) { Number x = new Integer (3);…
A: //we are getting the error because X is an Number and new Integer is an integer so we are not able…
Q: class Main public static void main(Stringt) args) ( String[] words - ( "Ruby", "C", "Python", "Java"…
A: 1. output for this code is: class hello { public static void main(String[] args) { String[]…
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: a one-dimensional string array and string You need to search for the given array and return the…
A: class Main{ static int Search(int array[], int al, int y) //counts the number of occurrences of a…
Q: public class output{ public static int find (int a1, int a2) if(al==0) return(al+1); else if(a1>0 &&…
A: Explanation:- 1. Initially both a1 and a2 value is 2. 2. Then the else condition will be hit for the…
Q: Write a method called firstUnique() that takes a string as a parameter and finds the first…
A: EXPLANATION - The first step is traverse the particular string by just using the pointer. Then keep…
Q: The String class is provided in the Java library.Provide your own implementation for the following…
A: Below is the required Java code to implement the given class and methods: - Explanation: - Defining…
Q: What does the following code print out? class Main { public static void main (String[] args) { int…
A: In this question, we have given a java code. We have to find the output of the code. We will run the…
Q: class Excep { public static void main(String[] args){ try{ int arr[]=(1,2}; int x = arr[1]/arr[0]-1;…
A: Define class Excep. Define main function. Define try block. Define array arr with values 1 and 2.…
Q: public static void main (String [] args) { first: for( int i = 1; i < 5; i++) { second: for(int j =…
A: Flow chart: The flow chart shows the steps as boxes of different types and their order when the…
Q: (in java) add a part where you print user information and update the continue watching list in…
A: Here , we have given the java class named Netflix. We need to create the two objects of this class…
Q: Create a method that print values of a given interval in a chain of strings beginning with the first…
A: I have made a change in the definition of node. instead of using data instance variable I have used…
Q: public static void doubleArray(int[] a){ int[] newA - new int[a.length]; for (int i = 0; i <…
A: Time complexity defines the worst case running time of the given program. It is denotes as O() -…
Q: public class P3 { public static void main(String[] args) { int[] intArray = new int[10]; for (int i…
A: It basically put value of i into array arrar[i] basically it adds number from 0 to 9…
Q: public class RepeatStrings { public static void main(String[] argv) throws Exception{ final int SIZE…
A: The complete program with fill ups is given below -
Q: public class output{ public static int check (int a, int b, int c) { if(a==0) return (b); else if…
A: Given:
Q: public class Main { public static void main(String[] args) { int result = sum(10, 10);…
A: Given Java program
Q: Make the code output sentence starts with a capitalization, and ends with a period. public class…
A: Send your complete code. I will answer. Have a great day.
Q: JAVA PROGRAM FLAMES GAME (SEE ATTACHED PHOTO FOR THE PROBLEM AND EXAMPLE) Implement the method…
A: import java.util.*; interface Flames { public int countLetters(String name1, String name2); public…
Q: Ex. If the input is: 4 plates 100 spoons 200 cups 150 forks 200 the output is: 200 forks…
A: Actually, the code has given beneath:
Q: public class MathF{ public static void main(String[] args) { char[] grade=new char[4]; grade[1]='B';…
A: Provided the output of the above code in the next step with a screenshot.
Q: public static void methodl (int i, int num) { for (int j System.out.print num = 2; 1; j <= i; j++) {…
A: The given code is written in Java.
Q: public static String pancakeScramble(String text) This nifty little problem is taken from the…
A: Code: public class Scramble { public static void main(String[] args) {…
Q: In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the…
A: The problem is based on the basics of classes in C++ programming language.
Q: public class My { public static void main(String [] args) { printAll(args); } public static void…
A: Consider the given code:
Q: public class MyClass { public static void main(String args[]) id(1) id(2) "s26j9876" }; id(0) String…
A: Length of id[0] is 8index of 7 in id[2] is 68+6=14Length of id is 3 So final output is 143
Q: Double any element's value that is less than controlValue. Ex: If controlValue = 10, then dataPoints…
A: Program: import java.util.Scanner; public class StudentScores { public static void main (String…
Q: class box { int width; int height; int length; int volume;…
A: The given code:- class box { int width; int height; int length; int volume; void…
Q: public class EscapeSequences { public static void main( String args[] ) { // Add a tab between…
A: Code public class EscapeSequences { public static void main(String args[]){ System.out.println("He…
Q: In Java. Sort the list of cars and display them. Sort by make, model, and year. Each car property…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: JAVA CODE: class quad{ public static void main(String args[] ){ Quadrilateral quadrilateral = new…
A: Errors that stop the source program from executing due to incorrect syntaxes are known as Compile…
Q: public class Test1 { private static int index = 0; public int x; Test1(){ index ++; } public static…
A: Encapsulation is an object oriented programming concept which is to provide more security for the…
Q: import java.util.*; public class Watersort { Character top = null; //…
A: public static boolean solved( StackAsMyArrayList bottles[]){boolean solved =true;for(int…
Q: public class Main5 public static void main(String] args) { int a = 5; int b = 6, float c = alb,…
A: The answer is as follows:-
Q: public class Ex1 { public static void main( String args[] ){ int array[] = { 1, 2, 3, 4, 5 };
A: Code:
Q: public class DebugBox { private int width; private int length; private int height;…
A: 1) In the parameterize constructor use int datatype before hight while decleration. 2) In the…
Q: public class Find Errors ( public static void main (String[] args) ( 3 int a = 8; %3D int b = 9.0;…
A: Q: Find errors in the given program
Q: 1. public class Foo { 2. public static void main (String[] args) { 3. int i=1: 4. int j =i++; 5. if…
A: d) 5
Q: public class Myjava Programs { public static void main(String[] args) { int row, column; row = 1; do…
A: The Flowchart is created using Online Flowchart Tool Below:
Q: 1 public class MathF( public static void main(String[] args) 3 { char[] grade-new char[4]; 4…
A: Answer:
Q: public class Main5 { public static void main(String[] args) { int a = 5; int b = 6, float c = a/b,…
A: You Can Use Type Casting .since a ,b is int type and c is float so you explicit tell the compiler…
Q: The output of the above Java code is ?
A: Given, Code: class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67,…
Q: public class main { public static void main(String [] args) { Dog dog1=new…
A: Program: public class main { public static void main(String [] args) { Dog dog1=new…
Q: public class Test { } public static void main(String[] args) { String str = "Salom";…
A: S
Q: public class Test { private int t; public static void main(String] args) { int x;…
A: Please give positive ratings for my efforts. Thanks. ANSWER Here, in the above program, t is…
Q: In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the…
A: - The question wants us to code for the area finding problem in C++.
Q: class Progarm1 { public static void main(String[] args) { int[] a = {1, 2}; q3(a);…
A: Given: Comparision between two programs
Q: Java: Class: MiddleStr Write a method public static String middle(String str) that returns a…
A: public class MiddleStr{ public static void main(String[] args) { System.out.println("Middle element…
Step by step
Solved in 2 steps with 1 images
- Q2/ Correct the code. class Box { public static void main (String args []) { int x; int y; } class BoxBox { public static void main (String args []) { BOXBOX mybox = new Box () ; double H; mybox.x = 1; mybox.yy = 2; H = myboxx.x + mybox.y * mybox.x; System.ouf.println ("H } + H); }public class Side Plot { * public static String PLOT_CHAR = "*"; public static void main(String[] args) { plotxSquared (-6,6); * plotNegXSquaredPlus20 (-5,5); plotAbsXplus1 (-4,4); plotSinWave (-9,9); public static void plotXSquared (int minX, int maxx) { System.out.println("Sideways Plot"); System.out.println("y = x*x where + minX + "= minX; row--) { for (int col = 0; col row * row; col++) { System.out.print (PLOT_CHAR); if (row== 0){ } System.out.print(" "); } for(int i = 0; i <= maxx* maxX; i++) { System.out.print("-"); } System.out.println(); Sideways PHOT y = x*x where -6<=x<=6 Sideways Plot y = x*x where -6<=x<=6 How do I fix my code to get a plot like 3rd picture?public class LabProgram { public static void main(String args[]) { Course course = new Course(); String first; // first name String last; // last name double gpa; // grade point average first = "Henry"; last = "Cabot"; gpa = 3.5; course.addStudent(new Student(first, last, gpa)); // Add 1st student first = "Brenda"; last = "Stern"; gpa = 2.0; course.addStudent(new Student(first, last, gpa)); // Add 2nd student first = "Jane"; last = "Flynn"; gpa = 3.9; course.addStudent(new Student(first, last, gpa)); // Add 3rd student first = "Lynda"; last = "Robison"; gpa = 3.2; course.addStudent(new Student(first, last, gpa)); // Add 4th student course.printRoster(); } } // Class representing a student public class Student { private String first; // first name private String last; // last name private double gpa; // grade point average…
- public class Number { private int num; public Number(int n) { num = n; } /* Type your code here */ public int getNum() { return num; } public void setNum(int n) { num = n; } public static void main(String [] args) { Number yourNum = new Number(723); System.out.print(yourNum); }}public class Application { public static void main(String[] args) { Employee empl = new Employee(); empl.firstName = "Ali"; empl.lastName = "Omar"; empl.salary = 20000; Employee emp2 = new Employee(); emp2.firstName = "Mohamed"; emp2.lastName = "Nour"; emp2.salary = 30000; System.out.println("- System.out.printin("- empl.employeeSalary(); System.out.println("- empl.checkEmployeeSalary(emp1.salary, emp2.salary); System.out.printin("- System.out.println("- printEmployee(emp2); System.out.printin("- Employee employeeArr[] = new Employee[2]: employeeArr[0] = empl; employeeArr[1] = emp2; Application a = new Åpplication(); a.printArrayofEmployee(employeeArr); Non static (instance) start to call Static function to print ---------"); "); - Non Static function to print - --"); Non static (instance) start to call same class Static function to print --------); -"); Non Static function to print ----); System.out.println("- System.out.printin("- System.out.printin("Salary : " + Employee.salary);…please
- using System; class Program { publicstaticvoid Main(string[] args) { int number = 1; while (number <= 88) { Console.WriteLine(number); number = number + 2; } int[] randNo = newint[88]; Random r = new Random(); int i=0; while (number <= 88) { randNo[i] = number; number+=1; i+=1; } for (i = 0; i < 3; i++) { Console.WriteLine("Random Numbers between 1 and 88 are " + randNo[r.Next(1, 88)]); } } } this code counts from 1-88 in odds and then selects three different random numbers. it keeps choosing 0 as a random number everytime. how can that be fixed?//Assignment 06 */public static void main[](String[] args) { String pass= "ICS 111"; System.out.printIn(valPassword(pass));} /* public static boolean valPassword(String password){ if(password.length() > 6) { if(checkPass(password) { return true; } else { return false; } }else System.out.print("Too small"); return false;} public static boolean checkPass (String password){ boolean hasNum=false; boolean hasCap = false; boolean hasLow = false; char c; for(int i = 0; i < password.length(); i++) { c = password.charAt(1); if(Character.isDigit(c)); { hasNum = true; } else if(Character.isUpperCase(c)) { hasCap = true; } else if(Character.isLowerCase(c)) { hasLow = true; } } return true; { return false; } }public class Driver { /** * @param args */ static Scanner keyboard = new Scanner(System.in); publicstaticvoid main(String[] args) { Mailbox[] mailboxes = new Mailbox[5]; Mailbox mailbox1 = new Mailbox("gmail"); Mailbox mailbox2 = new Mailbox("outlook"); Mailbox mailbox3 = new Mailbox("icloud"); mailboxes[0] = mailbox1; mailboxes[1] = mailbox2; mailboxes[2] = mailbox3; Email email1 = new Email(); email1.setDate(new Date(2022, 11, 5)); email1.setSubject("Exam2 guidelines "); Email email2 = new Email(new Date(2021, 3, 5), true, "Quiz3 in Ch7"); Email email3 = new Email(); email3.setDate(new Date(2020, 11, 3)); email3.setSubject("Late submission policy"); mailbox2.addEmail(email1); mailbox2.addEmail(email2); mailbox2.addEmail(email3); // System.out.println("Hello! What would you like to do "); intselection = displayMenu(); while (selection != 5) { // selection = displayMenu(); switch (selection) { case 1: System.out.print("Enter the client: "); String…
- Question - 2) Create a C# Console application(DOT net framework) using Visual Studio IDE. Project name should include students' firstname(s) followed by A1(Example: HarleenHardeep_A1) (Submission Instruction: sumbit the Zipped project folder) In this project. Rename Program.cs to A1Q2.cs. In A1Q2.cs do the following tasks: Step 1 Declare variables of different data types (at least 10 variables). Assign valid literals to those variables. Step 2) Step 3) Print the values of the variables using format strings and placeholders in Console.Write() Console.WriteLine(). 2 | Page ASSIGNMENT 1 CSD 2354 (C#) Print values of some variables in following formats: i) Currency Number Hexadecimal, iv) Percentage. Embed comment lines before each Console.WriteLine and explain, how the format strings and placeholders work. Perform some arithmetic operations on the variables you declared in step 1. You should demonstrate the use of following arithmetic operations +,-,/, * and % Demonstrate the use of…class Student { private int age = 18; public Student() { age = 19; } } public class Test { public static void main (String[] args){ Student s = new Student(); System.out.println (s.age); } }// 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…