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
Question
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 3 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
- There are five errors in this code. Correct the errors and make the code work. Explain what are the errors found. import java.util.Scanner; //Testing.java //Displays running total of numbers in lines of standard //input correct to two decimal places. //Uses an out of range number (100) to quit. public class TWODPS{ public static void main (String [] args) { Scanner input new Scanner (System.in); double total=0; boolean flag=true; System.out.println ("Use an out of range entry 100 to quit."); while (flag) { System.out.println ("Enter a number on a line:"); double d = input.nextDouble (); if (outofRange (d) ) { flag=false; else{ dispTwoDPs ("The number value is: ",d); total = total + d; dispTwoDPs ("The total is: ",total); System.out.println (); System.out.println ("Next."); } //end of else }//end of while System.out.println ("You quit."); }//end of main static boolean outOfRange (double d) { if (d>-100) return true; if (d>100) return true; return false; }arrow_forward1. Generalized harmonic numbers. Write a program GeneralizedHarmonic.java that takes two integer command-line arguments n and r and uses a for loop to compute the nth generalized harmonic number of order r, which is defined by the following formula: 1 1 +...+ 1 H(n,r) = +7 1" 1 1 1 For example, H(3,2) = 12 49 = 1.361111. 36 %3D 22 32 -/Desktop/loops> java GeneralizedHarmonic 1 1 1.0 -/Desktop/loops> java GeneralizedHarmonic 2 1 1.5 -/Desktop/loops> java GeneralizedHarmonic 3 1 1.8333333333333333 ~/Desktop/loops> java GeneralizedHarmonic 1 2 1.0 -/Desktop/loops> java GeneralizedHarmonic 2 2 1.25 ~/Desktop/loops> java GeneralizedHarmonic 3 2 1.3611111111111112 Note: you may assume that n is a positive integer. The generalized harmonic numbers are closely related to the Riemann zeta function, which plays a central role in number theory.arrow_forwardjava / eclipsearrow_forward
- %matplotlib inlineimport numpy as npfrom matplotlib import pyplot as pltfrom math import sin, cos, exp, pi, sqrtimport math def sawtooth(x): return x%2 #only works in python. other languages will scream. x = np.linspace(0,5,100)y = [sawtooth(xx) for xx in x]plt.plot(x,y,label='sawtooth')plt.grid() def magic(x): s = 0 s += 1 s += -2/pi*sin(pi*x) - 2/2./pi*sin(2*pi*x) - 2/3./pi*sin(3*pi*x) return smagical_y = [magic(xx) for xx in x]plt.plot(x, magical_y,'r-',label='magic')plt.legend(loc='upper left') 5.1def step(x): return 0.0 if x%3>(3./2) else 1.0x = np.linspace(0,5,1000)y = [step(xx) for xx in x]plt.plot(x,y,label='step')plt.grid()plt.ylim(-0.1,1.1)5.3def circ(x): r = 1 xx = (x%(2*r)) return sqrt(r**2-(xx-r)**2)x = np.linspace(0,5,1000)y = [circ(xx) for xx in x]plt.plot(x,y,label='step')plt.grid()plt.ylim(-0.1,1.1)arrow_forwardJava Programming: Write a program that reads five integer values from the user, then analyzes them as if they were a hand of cards. When your program runs it might look like this (user input is in orange for clarity): Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 8 Card 4: 2 Card 5: 9 Pair! (This is a pair, since there are two eights). You are only required to find the hands Pair and Straight.arrow_forwardWord Statistics: The second requirement change is to allow replacement of all occurrences of a given word to a given replacemWrite the code only in python language with the opeartion exactly and necessary comments to be added.arrow_forward
- Java - Musical Note Frequenciesarrow_forwardin python “c” represents a crop and “w” represents a water source. Each water source hydrates the eight tiles around it (including itself) Input the number of rows and columns in the crop field:ROWS> 4COLUMNS> 4Input each row of the crop field.ROW0> c c c wROW1> w c c cROW2> c c c cROW3> c w c cNot all crops are watered!OUTPUT FalseThe following crops are not watered:OUTPUT [(2, 3), (3, 3)] Input the number of rows and columns in the crop field:ROWS> 7COLUMNS> 1Input each row of the crop field.ROW0> cROW1> wROW2> cROW3> cROW4> wROW5> cROW6> wAll crops are watered!OUTPUT Truearrow_forwardIntro to Java Instuctions: Design and implement a program that reads a series of 10 integers from the user and prints their average For each of the 10 numbers input from the user: one at a time, prompt the user to enter a number. Then read input from the user as a string. Attempt to convert it to an integer using the "Integer.parseInt" method. If the process throws a "NumberFormatExeption", print an appropriate error message and prompt the user for the number again. Continue prompting and reading in number until 10 valid integers have been read Print "The average is" and then print the average of the 10 numbers Code: import java.util.Scanner; public class Lab1MainClass { public static final int VALUES_TO_READ = 10; public static void main(String[] args) { // local variables int[] values = new int [VALUES_TO_READ]; double average; Scanner scan = new Scanner(System.in); int values Read = 0; // how many numbers the user has given us, a count of where we are String userInput; // read…arrow_forward
- CODE IN PYTHON Colouring Book Having spent the last couple of hours grading assignments, I decide it’s time for a break. I take out my favourite colouring book, turn to a random page I haven’t coloured in yet, and lay it on my desk. I then take out all my n crayons and line them up on the desk (it’s a very long desk). The colour of the ith crayon is a string c[i] (e.g. "blue"). Many of the crayons have the same colour. In fact, no matter how many crayons I have, there are at most 30 distinct colours amongst them. To start colouring, I always take a sublist (see Q1 for a definition) of the crayons laid on the desk and put away the rest (too many options can be overwhelming and can lead to indecision). I take a look at the line art in front of me and wonder, “How many different colours do I need to make this look great? One? Two? Maybe three?”. Now you understand my dilemma and are fully aware of my indecision. You kindly decide to help me out by telling me for every number k, if I were…arrow_forwardHelp code in Java 21. Compound InterestWhen a bank account pays compound interest, it pays interest not only on the principal amount thatwas deposited into the account, but also on the interest that has accumulated over time. Suppose youwant to deposit some money into a savings account, and let the account earn compound interest for acertain number of years. The formula for calculating the balance of the account after a specifiednumber of years is:A = P ( 1 + r n ) n tThe terms in the formula are:A is the amount of money in the account after the specified number of years.P is the principal amount that was originally deposited into the account.r is the annual interest rate.n is the number of times per year that the interest is compounded.t is the specified number of years.Write a program that makes the calculation for you. The program should ask the user to input thefollowing:The amount of principal originally deposited into the accountThe annual interest rate paid by the accountThe…arrow_forwardWrite an application that reads an integer value from the user and prints the sum ofall even integers between 2 and the input value, inclusive. Print an error message ifthe input value is less than 2. Use Java. Sample Run Examples: Example 1:the user enters 14Output: Sum: 56Example 2:the user enters 1Output: Error number must be greater than 1arrow_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