Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Compare and contrast in your own words a pure counter-controlled for loop with a while loop illustrating your answer using the following example functions. You may assume that the dice function returns an integer between 1 and 6.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Number of digits int main() {int c=0;int i=3856; int l=i; while(l>0) {l=l/10; c++; } printf("%d",c); return 0; } Summation of digits int main() {int sum=0; int i=384; int l=i; while(l>0) { sum+=l%10; l=l/10;} printf("%d",sum); return 0; }arrow_forwardpublic 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…arrow_forwardInput class ternary_operator { public static void main(String args[]) { int x = 3; int y = ~ x; int z; z = x > y ? x : y; System.out.print(z); } } Find outputarrow_forward
- Class Quiz public Quiz (int quesList, int quesMissed) {quesList = this.quesList;quesMissed = this.quesMissed;} private void calculate(){// get the point worth of each question and calculate final scorepointsPerQues = (100/quesList);scoreQuiz = quesList - quesMissed;} Class PassFailQuiz public PassFailQuiz (int quesList, int quesMissed, int scoreQuiz) { super(quesList, quesMissed);} How do I move scoreQuiz from private void calculate() to equal the third constructor value in PassFailQuiz?arrow_forwardint pertambahan(int pilihan, int now){ int result; result =pilihan + now; return result;} int perkalian(int pilihan, int now){ int result; result = pilihan*now; return result;} int main(){ int NoR,initial; int now; int temp1, temp2; scanf("%d %d", &NoR, &initial); getchar(); now=initial; for(int o=0;o<NoR;o++){ char a,b; int pilihan1,pilihan2; scanf("%c %d %c %d",&a, &pilihan1,&b, &pilihan2); getchar(); if(a=='+') { if(pilihan1>=-1000 && pilihan1<=1000) { temp1 = pertambahan(pilihan1,now); } else{ temp1=-10000; } } else if(a=='x') { if(pilihan1>=-2 && pilihan1<=2){ temp1 = perkalian(pilihan1,now); } else { temp1=-10000; } } if(b=='+') { if(pilihan2>=-1000 && pilihan2<=1000) { temp2 = pertambahan(pilihan2,now); } else {…arrow_forward//Main.cpp 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_forward
- class main { public static void main(String args[]) { int x =2; int y =0; for(; y <10;++y) { if(y % x ==0) continue; elseif(y ==8) break; else System.out.print(y +" "); } } } Give result for the code Java Try to do ASAParrow_forwardTrace through the following program and show the output. Show your work for partial credit. public class Employee { private static int empID = 1111l; private String name , position; double salary; public Employee(String name) { empID ++; this.name 3 пате; } public Employee(Employee obj) { empID = obj.empĪD; пате %3D оbj.naте; position = obj.position; %3D public void empPosition(String empPosition) {position = empPosition;} public void empSalary(double empSalary) { salary = empSalary;} public String toString() { return name + " "+empID + " "+ position +" $"+salary; public void setName(String empName){ name = empName;} public static void main(String args[]) { Employee empOne = new Employee("James Smith"), empTwo; %3D empOne.empPosition("Senior Software Engineer"); етрOпе.етpSalary(1000); System.out.println(empOne); еmpTwo empTwo.empPosition("CEO"); System.out.println(empOne); System.out.println(empTwo); %3D етpОпе empOne ;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 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_forwardIn C++ QUESTION 14 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; }; Write the function definition for the function perimeterarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education