What will the following
public class Checkpoint
{
public static void main(String[ ] args)
{
int num1 = 99;
double num2 = 1.5;
System.out.println(num1 + “ ” + num2); myMethod(num1, num2);
System.out.println(num1 + “ ” + num2);
}
public static void myMethod(int i, double d)
{
System.out.println(i + “ ” + d);
i = 0;
d = 0.0;
System.out.println(i + “ ” + d);
}
}
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Starting Out with Java: From Control Structures through Objects (6th Edition)
Additional Engineering Textbook Solutions
Degarmo's Materials And Processes In Manufacturing
Problem Solving with C++ (10th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Concepts Of Programming Languages
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
- class Variables { public static void main(String[] args) { .arrow_forwardclass isinfinite_output { public static void main(String args[]) { Double d = new Double(1 / 0.); boolean x = d.isInfinite(); System.out.print(x); } } What will the given code prints on the output screen.arrow_forwardpublic class Test { } public static void main(String[] args) { int a = 5; a += 5; } switch(a) { case 5: } System.out.print("5"); break; case 10: System.out.print("10"); System.out.print("0"); default:arrow_forward
- 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?arrow_forward// ArtShow.java - This program determines if an art show attendee gets a 5% discount // for preregistering. // Input: Interactive. // Output: A statement telling the user if they get a discount or no discount. import java.util.Scanner; public class ArtShow { public static void main(String args[]) { Scanner s = new Scanner(System.in); String registerString; System.out.println("Did you preregister? Enter Y or N: "); registerString = s.nextLine(); // Test input here. If Y, call discount(), else call noDiscount(). System.exit(0); } // End of main() method. // Write discount method here. // Write noDiscount method here. } // End of ArtShow class.arrow_forward10. public static void methodl (int i, int num) { for (int j = 1; j <= i; j++) { " "); System.out.print (num + num *= 2; } System.out.println(); } public static void main(String[] args) { int i = 1; while (i <= 6) { methodl (i, 2); i++; }arrow_forward
- //Main.java public class Main{ public static void main(String[] args) { final int NUM_FLOORS = 5; Hotel[] floor_number = new Hotel[NUM_FLOORS]; floor_number[0] = new Hotel(20, 14, 168.99); floor_number[1] = new Hotel(33, 18, 152.99); floor_number[2] = new Hotel(33, 12, 152.99); floor_number[3] = new Hotel(33, 15, 152.99); floor_number[4] = new Hotel(16, 8, 254.99); System.out.printf("%-8s%-10s%-12s%-18s%-15s %-10s\n", "Floor", "Rooms", "Occupied", "Occupancy Rate", "Room Price", "Revenue"); for (int i = 0; i < floor_number.length; i++) { Hotel current_hotel_number = floor_number[i]; int rooms = current_hotel_number.getRooms(); int occupiedRooms = current_hotel_number.getOccupiedRooms(); double roomCost = current_hotel_number.getRoomCost(); double occupancyRate = current_hotel_number.getFloorOccupancyRate(); double revenue =…arrow_forward//Main.java public class Main { public static void main(String[] args) { final int NUM_FLOORS = 5; Hotel[] floor_number = new Hotel[NUM_FLOORS]; floor_number[0] = new Hotel(20, 14, 168.99); floor_number[1] = new Hotel(33, 18, 152.99); floor_number[2] = new Hotel(33, 12, 152.99); floor_number[3] = new Hotel(33, 15, 152.99); floor_number[4] = new Hotel(16, 8, 254.99); System.out.printf("%-6s %-8s %-10s %-15s %-12s %-10s\n", "Floor", "Rooms", "Occupied", "Occupancy Rate", "Room Price", "Revenue"); for (int i = 0; i < floor_number.length; i++) { Hotel current_hotel_number = floor_number[i]; int rooms = current_hotel_number.getRooms(); int occupiedRooms = current_hotel_number.getOccupiedRooms(); double roomCost = current_hotel_number.getRoomCost(); double occupancyRate = current_hotel_number.getFloorOccupancyRate(); double revenue =…arrow_forwardpublic class main { public static void main(String [] args) { Dog dog1=new Dog(“Spark”,2),dog2=new Dog(“Sammy”,3); swap(dog1, dog2); System.out.println(“dog1 is ”+ dog1); System.out.println(“dog2 is ”+ dog2); } public static void swap(Dog a, Dog b) { String nameA = a.getName(); String nameB = b.getName(); a.setName(nameB); b.setName(nameA); } What is the output of the main()?arrow_forward
- 1- public class MathF{ public static void main(String[] args) { char[] grade=new char[4]; 4 grade[1]='B'; grade[3]='C'; Integer d1= new Integer(6); 7 Integer d2= new Integer(10); 8- if(d1!= d2){ System.out.println("grades do not match "); 10 System.out.println("Result: "+Math.sqrt(d1+d2)); 11 } 5 12 else 13- { System.out.println("Marks are same"); 14 for (int i=0;i<4;i++) System.out.println(grade[i]); } 16 }} Answer:arrow_forwardpublic class Course{String name;String dept;int number;public Course (String n, String d, int n){name = n;dept = d;number = n;}public String toString(){return "Course " + name + " in " + dept + " #: " + number;}public static void main (String [] args){Scanner in = new Scanner(System.in);add 10 lines using the scanner and saving them as strings The input for each line will be entered a String, a space, another String, and an int. Parse the input string into those three items and make an instance of Course. Add the new Course instance to a generic ArrayList of Course. print out each Course in the ArrayList.arrow_forwardclass Main { public static void main(String args[]) { String obj = "I am a programmer."; System.out.println(obj.length()); } } #Run the codearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education