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
Concept explainers
Textbook Question
Chapter 4, Problem 4.26PE
(Financial application: monetary units) Rewrite Listing 2.10, ComputeChange.java, to fix the possible loss of accuracy when converting a float value to an int value. Read the input as a string such as "11.56". Your program should extract the dollar amount before the decimal point, and the cents after the decimal amount using the indexOf and substring methods.
Note
More than 200 additional
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What is the shortest path from vertex 3 to all other vertices:Which graph algorithm can solve the problem most efficiently(the quickest runtime)How could the same algorithm if the graph had edge weights? (create intermediate nodes)
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
Chapter 4 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Ch. 4.2 - Evalute the following method calls: (a)...Ch. 4.2 - True or false? The argument for trigonometric...Ch. 4.2 - Write a statement that converts 47 degrees to...Ch. 4.2 - Write a statement that converts PI to an angle in...Ch. 4.2 - Write an expression that obtains a random integer...Ch. 4.2 - Prob. 4.2.6CPCh. 4.2 - Prob. 4.2.7CPCh. 4.3 - Use print statements to find out the ASCII code...Ch. 4.3 - Which of the following are correct literals for...Ch. 4.3 - How do you display the characters \ and "?
Ch. 4.3 - Evaluate the following: Int i = '1'; int j ='1' +...Ch. 4.3 - Can the following conversions involving casting be...Ch. 4.3 - Show the output of the following program: public...Ch. 4.3 - Write the code that generates a random lowercase...Ch. 4.3 - Show the output of the following statements:...Ch. 4.4 - Suppose s1, s2, and s3 are three strings, given as...Ch. 4.4 - Prob. 4.4.2CPCh. 4.4 - Show the output of the following statements (write...Ch. 4.4 - Prob. 4.4.4CPCh. 4.4 - Let s1 be " Welcome " and s2 be " welcome ". Write...Ch. 4.4 - Write one statement to return the number of digits...Ch. 4.4 - Write one statement to return the number of digits...Ch. 4.5 - If you run Listing 4.3 GuessBirthday.java with...Ch. 4.5 - If you enter a lowercase letter such as b, the...Ch. 4.5 - What would be wrong if lines 6 and 7 are in...Ch. 4.6 - Prob. 4.6.1CPCh. 4.6 - Prob. 4.6.2CPCh. 4.6 - Show the output of the following statements: (a)...Ch. 4 - (Geometry: area of a pentagon) Write a program...Ch. 4 - (Geometry: great circle distance) The great circle...Ch. 4 - (Geography: estimate areas) Use the GPS locations...Ch. 4 - (Geometry: area of a hexagon) The area of a...Ch. 4 - (Geometry: area of a regular polygon) A regular...Ch. 4 - (Random points on a circle) Write a program that...Ch. 4 - (Corner point coordinates) Suppose a pentagon is...Ch. 4 - (Find the character of an ASCII code) Write a...Ch. 4 - (Find the Unicode of a character) Write a program...Ch. 4 - (Guess birthday) Rewrite Listing 4.3,...Ch. 4 - (Decimal to hex) Write a program that prompts the...Ch. 4 - (Hex to binary) Write a program that prompts the...Ch. 4 - (Vowel or consonant?) Write a program that prompts...Ch. 4 - (Convert Letter grade to number) Write a program...Ch. 4 - (Phone key pads) The international standard...Ch. 4 - (Random character) Write a program that displays a...Ch. 4 - (Days of a month) Write a program that prompts the...Ch. 4 - (Student major and status) Write a program that...Ch. 4 - (Business: check ISBN-10) Rewrite Programming...Ch. 4 - (Process a string) Write a program that prompts...Ch. 4 - (Check SSN) Write a program that prompts the user...Ch. 4 - (Check substring) Write a program that prompts the...Ch. 4 - 23 (Financial application: payroll) Write a...Ch. 4 - (Order three cities) Write a program that prompts...Ch. 4 - (Generate vehicle plate numbers) Assume that a...Ch. 4 - (Financial application: monetary units) Rewrite...
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
- 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.arrow_forwarda) 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_forward
- Books (bid, author, title, publisher, year, notes); Members (mid, name, surname, street, city, country, phone, notes); Borrow (rid, bid, mid, date, notes);arrow_forwardCustomer (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_forward
- Data 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_forwardAn 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_forward
- Customer (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_forwardParts( 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_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 Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License