Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134700144
Author: Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 5, Problem 5.24PE
Program Plan Intro
Sum of series
- Include the required import statement.
- Define the class
- Define the main method using public static main.
- Declare and initialize the required variable.
- Using for loop,
- Calculate the sum of series.
- Display the result on the output screen.
- Define the main method using public static main.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The difference between (1) a database management system (DBMS) and (2) a database, is:
a.
The first refers to a complete accounting system, the second refers to a subset of that
b.
The first is program software, the second is proprietary data and related files
c.
The first is hardware, the second is software
d.
Nothing—these terms are synonyms..
a) An example of the linear hash index is given below. Every time a new overflow
page is added, the bucket pointed by Next is split, and Next is incremented by one.
Show the index state after adding the keys 39, 25, and 29.
hi
ho
Level=0, N=4
000
00
0*8*
001
01
17*33*
010
10
6*26* 42*
011
11
7* 11* 15* 23*
100
00
4* 12* 20*
101
01
5* 13* 21* 37*
Next
What would be the runtime (big-O asymptotic notation) of Dijkstra’s algorithm if it is implemented based on an unsorted minimum priority queue in terms of vertices (v) and edges (e)? Please show all steps including the runtime of each step of the algorithm.
Chapter 5 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Ch. 5.2 - Prob. 5.2.1CPCh. 5.2 - How many times are the following loop bodies...Ch. 5.2 - Prob. 5.2.3CPCh. 5.3 - What is wrong if guess is initialized to 0 in line...Ch. 5.4 - Revise the code using the System. nanoTime () to...Ch. 5.5 - Prob. 5.5.1CPCh. 5.6 - Prob. 5.6.1CPCh. 5.6 - What are the differences between a while loop and...Ch. 5.7 - Do the following two loops result in the same...Ch. 5.7 - What are the three parts of a for loop control?...
Ch. 5.7 - Suppose the input is 2 3 4 5 0. What is the output...Ch. 5.7 - What does the following statement do? for ( ; ; )...Ch. 5.7 - If a variable is declared in a for loop control,...Ch. 5.7 - Convert the following for loop statement to a...Ch. 5.7 - Count the number of iterations in the following...Ch. 5.8 - Can you convert a for loop to a while loop? List...Ch. 5.8 - Can you always convert a while loop into a for...Ch. 5.8 - Identify and fix the errors in the following code:...Ch. 5.8 - Prob. 5.8.4CPCh. 5.9 - How many times is the println statement executed?...Ch. 5.9 - Show the output of the following programs. (Hint:...Ch. 5.11 - Will the program work if n1 and n2 are replaced by...Ch. 5.11 - In Listing 5.11. why is it wrong if you change the...Ch. 5.11 - In Listing 5. 11, how many times the loop body is...Ch. 5.11 - Prob. 5.11.4CPCh. 5.11 - Prob. 5.11.5CPCh. 5.12 - What is the keyword break for? What is the keyword...Ch. 5.12 - The for loop on the left is converted into the...Ch. 5.12 - Rewrite the programs TestBreak and TestContinue in...Ch. 5.12 - After the break statement in (a) is executed in...Ch. 5.13 - What happens to the program if (low high) in line...Ch. 5.14 - Simply the code in lined 27-32 using a conditional...Ch. 5 - (Count positive and negative numbers and compute...Ch. 5 - (Repeat additions) Listing 5.4,...Ch. 5 - (Conversion from kilograms to pounds) Write a...Ch. 5 - (Conversion from miles to kilometers) Write a...Ch. 5 - (Conversion from kilograms to pounds and pounds to...Ch. 5 - Prob. 5.6PECh. 5 - (Financial application: compute future tuition)...Ch. 5 - (Find the highest score) Write a program that...Ch. 5 - (Find the two highest scores) Write a program that...Ch. 5 - (Find numbers divisible by 5 and 6) Write a...Ch. 5 - (Find numbers divisible by 5 or 6, but not both)...Ch. 5 - (Find the smallest n such that n2 12,000) Use a...Ch. 5 - (Find the largest n such that n3 12,000) Use a...Ch. 5 - (Compute the greatest common divisor) Another...Ch. 5 - (Display the ASCII character table) Write a...Ch. 5 - (Find the factors of an integer) Write a program...Ch. 5 - (Display pyramid) Write a program that prompts the...Ch. 5 - (Display four patterns using Loops) Use nested...Ch. 5 - (Display numbers in a pyramid pattern) Write a...Ch. 5 - (Display prime numbers between 2 and 1,000) Modify...Ch. 5 - Prob. 5.21PECh. 5 - For the formula to compute monthly payment, see...Ch. 5 - (Demonstrate cancellation errors) A cancellation...Ch. 5 - Prob. 5.24PECh. 5 - (Compute ) You can approximate by using the...Ch. 5 - (Compute e) You can approximate e using the...Ch. 5 - (Display leap years) Write a program that displays...Ch. 5 - (Display the first days of each month) Write a...Ch. 5 - (Display calendars) Write a program that prompts...Ch. 5 - (Financial application: compound value) Suppose...Ch. 5 - (Financial application: compute CD value) Suppose...Ch. 5 - (Game: lottery) Revise Listing 3.8, Lottery.java,...Ch. 5 - (Perfect number) A positive integer is called a...Ch. 5 - (Game: scissor; rock, paper) Programming Exercise...Ch. 5 - (Summation) Write a program to compute the...Ch. 5 - (Business application: checking ISBN) Use loops to...Ch. 5 - (Decimal to binary) Write a program that prompts...Ch. 5 - (Decimal to octal) Write a program that prompts...Ch. 5 - (Financial application: find the sales amount) You...Ch. 5 - (Simulation: heads or tails) Write a program that...Ch. 5 - (Occurrence of max numbers) Write a program that...Ch. 5 - (Financial application: find the sales amount)...Ch. 5 - (Math: combinations) Write a program that displays...Ch. 5 - (Computer architecture: bit-level operations) A...Ch. 5 - (Statistics: compute mean and standard deviation)...Ch. 5 - (Reverse a string) Write a program that prompts...Ch. 5 - (Business: check ISBN-13) ISBN -13 is a new...Ch. 5 - (Process string) Write a program that prompts the...Ch. 5 - (Count vowels and consonants) Assume that the...Ch. 5 - Prob. 5.50PECh. 5 - (Longest common prefix) Write a program that...
Knowledge Booster
Similar questions
- a) An extendable hashing index is given below. Present the state of the index after adding the keys 21, 25, and 29. Directory Buckets 0*8* 12* 20* 00 9* 13*33* 01 10 6*26* 42* 11 7* 11* 15*23* b) Explain the concepts of global depth and local depth of buckets. Which buckets in the index above (after inserting 21, 25 and 29) have a global depth equal to the local depth? c) Describe the bulk loading algorithm for B+ trees. What are the differences to using a simple B+ tree add operation?arrow_forwardb) Below is an example of a B+ tree. Add an element with key 19 and then delete an element with key 1. Present the final result. 1* 3* . 10 18 24 27 37 10*15* - 18 20 22 24*26* 24* 26* - 27* 30*32* 37*40*arrow_forwardBooks (bid, author, title, publisher, year, notes); Members (mid, name, surname, street, city, country, phone, notes); Borrow (rid, bid, mid, date, notes);arrow_forward
- Customer (cid, name, surname, city, address, phone) Account (aid, cid, amount, currency, created) Deposit (did, aid, cid, amount, date) Withdraw(wid, aid, cid, amount, date)arrow_forwardData environment The SPJ company manages the orders of the parts from the suppliers for the projects that run at other companies. A project is described with the project identifier, name, company where the project takes part, budget, start date, and the duration of the project. A part is presented with the part identifier, name, and price. A supplier is described by the supplier identifier, name, address, city and phone number. For each order of a product from a given supplier for a given project, we store the number of parts ordered, the price of the order, the date, and the comment. The information system SPJ includes the following tables. Parts pid, name, price ); Projects( jid, name, company, budget, start, duration ); Suppliers sid, name, address, city, phone ); Orders oid, pid, jid, sid, quantity, price, date, comment );arrow_forwardData environment The SPJ company manages the parts orders from the suppliers for the projects that run at other companies. A project is described with the project identifier, name, company where the project takes part, budget, start date, and the duration of the project. A part is presented with the part identifier, name, and price. A supplier is described by the supplier identifier, name, address, city and phone number. For each order of a product from a given supplier for a given project, we store the number of parts ordered, the price of the order, the date, and the comment. The information system SPJ includes the following tables. Parts pid, name, price ); Projects( jid, name, company, budget, start, duration ); Suppliers sid, name, address, city, phone ); Orders oid, pid, jid, sid, quantity, price, date, comment );arrow_forward
- An example of a linear hash index is given below. Every time a new overflow page is added, the bucket pointed by Next is split and Next is incremented by one. Show the index state after adding the keys 10, 13, and 15. h₁ ho Level=0, N=4 000 00 0*8* 001 01 9* 25* 33* Next 010 10 6* 26* 42* 46* 011 11 7* 11*23* 100 00 4* 12*20* 101 01 5* 29* 37*21*arrow_forwardCustomer (cid, name, surname, city, address, phone); Account (aid, cid, amount, created, comment); Transfer (tid, from_aid, to_aid, cid, amount, date, descr);arrow_forwardCustomer (cid, name, surname, city, address, phone); Account (aid, cid, amount, created, comment); Payment (pid, payer_aid, ref_num, vend_aid, vend_com, amount, date); Transfer (tid, from_aid, to_aid, cid, amount, date, descr);arrow_forward
- Parts( pid, name, price); Projects( jid, name, company, budget, start, duration ); Suppliers sid, name, address, phone ); Orders oid, pid, jid, sid, quantity, amount, date, comment );arrow_forwardData environment The most important tables of the Faculty Information System are as follows. Course (cid, title, tid, description) Teacher (tid, name, surname, address, phone) Student (sid, name, surname, address, program, year, phone, descr) Register(sid, cid,d_register,grade,d_grade) A course is described by an identifier, a title, an identifier of a teacher that helds the course, and a text field. A teacher is represented by an identifier, a name and a surname, an address, and a phone number. A student is described by using an id, a name and a surname, an address, a study program (string), a year (integer), a phone number, and a text field. The table Register represents the registrations of students to courses. Registration is described by a student identifier, a course identifier, the date of registration (d_register), a grade, and the date of the grade (d_grade).arrow_forwardData environment IBL The company Internet Big Library (abbr. IBL) was established in the year 2000. The most important tables of the IBL information system are as follows. Books (bid, author, title, publisher, year, notes); Members (mid, name, surname, street, city, country, birthday, phone, notes); Borrow (rid, bid, mid, date, notes);arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr