Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1, Problem 16RE
In How To 1.1, you made assumptions about the price of gas and annual usage to compare cars. Ideally, you would like to know which car is the better deal without making these assumptions. Why can’t a computer
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
IN C++
This is a simulated chess game. With this project, I want you to move all the pieces on one side of the board.
First: If you are unsure how the pieces of a chess board move, do some research. There is plenty of information out there to instruct how a chessboard functions. Your chess piece movement must follow the rules of the game.
Second: This is a one-sided board and used to illustrate how each piece moves.
Third: The program must keep track of the location of each piece. By this I mean that if a piece is moving, it must respect the position of the other pieces on the board.
Fourth: With each move the user should also be given the option to start a new game or end the program.
MBG students want to change the genetics of plants in AGU. The new plant has a different growing sequence. It grows t cm each day, but every night it loses its height by k cm. While they were discussing that new interesting model, they wanted to formalize the growing algorithm. You should help the student calculate how many days are needed for the plant to grow m cm.
Your program on java will take 3 integer values, t, k, and m, respectively. One line output will be showing the number of days.
Sample Input:
4 1 5
Sample Output:
2
What is the probability that in a classroom of x people, at least 2 will be born on the same day of the year (ignore leap year)? Use a Monte Carlo Simulation and a frequency table to write a program that calculates this probability, where the number of people (x) in the simulated class is given by the user. The probability for a class of size 23, should be right around 50%.
PLEASE use the code outline given below to answer this question:
import mathimport random
# create and initialize frequency table:ft = []k = 0while(k < 365) : ft.append(0) k = k+1
# Allow the user to determine class size:print("Please type in how many people are in the class: ")x= int(input())
success = 0
# Simulate:c = 0while(c < 10000) : # Step 1: re-initialize birthday frequency table (it must be re-initialized for each play-through (why?): k = 0 while(k < 365) : ft[k] = 0 k = k+1 # Step 2: randomly get x birthdays and update frequency table: k = 0 while(k < x): # your code…
Chapter 1 Solutions
Big Java Late Objects
Ch. 1.1 - What is required to play music on a computer?Ch. 1.1 - Why is a CD player less flexible than a computer?Ch. 1.1 - What does a computer user need to know about...Ch. 1.2 - Prob. 4SCCh. 1.2 - Which part of the computer carries out arithmetic...Ch. 1.2 - A modern smartphone is a computer, comparable to a...Ch. 1.3 - What are the two most important benefits of the...Ch. 1.3 - Prob. 8SCCh. 1.4 - Prob. 9SCCh. 1.4 - Prob. 10SC
Ch. 1.5 - How do you modify the HelloPrinter program to...Ch. 1.5 - How would you modify the HelloPrinter program to...Ch. 1.5 - Would the program continue to work if you replaced...Ch. 1.5 - What does the following set of statements print?...Ch. 1.5 - What do the following statements print?...Ch. 1.6 - Suppose you omit the "" characters around Hello,...Ch. 1.6 - Suppose you change println to Printline in the...Ch. 1.6 - Suppose you change main to hello in the...Ch. 1.6 - Prob. 19SCCh. 1.6 - Prob. 20SCCh. 1.7 - Prob. 21SCCh. 1.7 - Suppose your cell phone carrier charges you 29.95...Ch. 1.7 - Consider the following pseudocode for finding the...Ch. 1.7 - Suppose each photo in Self Check 23 had a price...Ch. 1.7 - Prob. 25SCCh. 1.7 - Prob. 26SCCh. 1 - Explain the difference between using a computer...Ch. 1 - Prob. 2RECh. 1 - Prob. 3RECh. 1 - Prob. 4RECh. 1 - Prob. 5RECh. 1 - Prob. 6RECh. 1 - What does this program print? public class Test {...Ch. 1 - What does this program print? Pay close attention...Ch. 1 - Prob. 9RECh. 1 - Write three versions of the HelloPrinter.java...Ch. 1 - How do you discover syntax errors? How do you...Ch. 1 - The cafeteria offers a discount card for sale that...Ch. 1 - Write an algorithm to settle the following...Ch. 1 - Consider the question in Exercise R1.13. Suppose...Ch. 1 - In order to estimate the cost of painting a house,...Ch. 1 - In How To 1.1, you made assumptions about the...Ch. 1 - Suppose you put your younger brother in charge of...Ch. 1 - Write pseudocode for an algorithm that describes...Ch. 1 - The ancient Babylonians had an algorithm for...Ch. 1 - Write a program that prints a greeting of your...Ch. 1 - Write a program that prints the sum of the first...Ch. 1 - Write a program that prints the product of the...Ch. 1 - Write a program that prints the balance of an...Ch. 1 - Write a program that displays your name inside a...Ch. 1 - Write a program that prints your name in large...Ch. 1 - Write a program that prints your name in Morse...Ch. 1 - Write a program that prints a face similar to (but...Ch. 1 - Write a program that prints an imitation of a Piet...Ch. 1 - Write a program that prints a house that looks...Ch. 1 - Write a program that prints an animal speaking a...Ch. 1 - Write a program that prints three items, such as...Ch. 1 - Write a program that prints a poem of your choice....Ch. 1 - Write a program that prints the United States...Ch. 1 - Type in and run the following program. Then modify...Ch. 1 - Type in and run the following program. Then modify...Ch. 1 - Modify the program from Exercise E1.16 so that the...Ch. 1 - Prob. 18PECh. 1 - Write a program that prints a two-column list of...Ch. 1 - In the United States there is no federal sales...Ch. 1 - To speak more than one language is a valuable...Ch. 1 - You want to decide whether you should drive your...Ch. 1 - You want to find out which fraction of your cars...Ch. 1 - The value of can be computed according to the...Ch. 1 - Imagine that you and a number of friends go to a...Ch. 1 - Write an algorithm to create a tile pattern...Ch. 1 - Write an algorithm that allows a robot to mow a...Ch. 1 - Consider a robot that is placed in a room. The...Ch. 1 - Consider a robot that has been placed in a maze....Ch. 1 - Suppose you received a loyalty promotion that lets...Ch. 1 - A television manufacturer advertises that a...Ch. 1 - Cameras today can correct red eye problems caused...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
A recursive algorithm must _____ in the base case. a. solve the problem without recursion b. reduce the problem...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
In Exercises 53 through 56, determine the output produced by the lines of code where Courier New is the font se...
Introduction to Programming Using Visual Basic (10th Edition)
Magic Dates The date June 10, 1960, is special because when we write it in the following format, the month time...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
What two questions should you ask to determine a classs responsibilities?
Starting Out with Java: Early Objects (6th Edition)
What is the output produced by the following? Stringtest=abcdefg;System.out.printlntest.length();System.out.pri...
Absolute Java (6th Edition)
T F: When a string variable is created in memory, Visual Basic assigns it the initial value 0.
Starting Out With Visual Basic (7th Edition)
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
- I need help with coding this in Java language.arrow_forwardYour task is to develop a Tic-Tac-Toe (also called as “Noughts and Crosses”) game in Java using Swing. In this assignment, you are asked to implement a single-player version of the Tic-Tac-Toe game with easy-to-use graphical user interface (GUI). One player will be the user and the second player will be artificial intelligence (AI), namely, the computer. The entire procedure of the implementation has been split into three tasks with detailed description and explanation provided. By completing the three tasks, you will develop your own Tic-Tac-Toe game. Task 1: GUI ImplementationPlease implement a GUI satisfying the following requirements.• A menu bar with two buttons “Reset” and “Quit”. User can click the “Reset” button to restore the software to the initial status. User can software the game by clicking the “Quit” button;• The top pane is an information board to display username and present some basic guidance to the user about this game. The information board will also print out the…arrow_forwardCorrect answer will be upvoted else downvoted. Computer science. You are given a positive integer x. Check whether the number x is representable as the amount of the solid shapes of two positive integers. Officially, you really want to check in case there are two integers an and b (1≤a,b) to such an extent that a3+b3=x. For instance, in the event that x=35, the numbers a=2 and b=3 are reasonable (23+33=8+27=35). In the event that x=4, no pair of numbers an and b is reasonable. Input The primary line contains one integer t (1≤t≤100) — the number of experiments. Then, at that point, t experiments follow. Each experiment contains one integer x (1≤x≤1012). Kindly note, that the input for some experiments will not squeeze into 32-cycle integer type, so you should use something like 64-bit integer type in your programming language. Output For each experiment, output on a different line: "Indeed" in case x is representable as the amount of the 3D shapes of two…arrow_forward
- Programming language is C. I would really be appriciate if you could help me with this. Please provide me with your cashapp, so I can tip you for your work. THANK YOU:) In this project, we shall simulate the operations of an ATM machine. Suppose you’re in charge of this simulation and here is a scenario of what is required to do: The customer will be assigned a random or fixed number for his/her balance. First, the customer is prompted to enter his personal identification number pin (for this case study, we test only if this pin is formed by 4 digits! otherwise, a message like “Invalid PIN, try again . . .” will be displayed) and the user is re-prompted to enter the pin. The customer is given three chances to enter his pin. If he/she fails during the three trials you display a message like “Sorry you can’t continue, contact your bank for assistance!” If the pin is correct (formed by 4 digits), then the system will ask the customer for the receipt ( 1 for YES and 2 for NO ) and a menu…arrow_forwardUSING TKinter Please create a Python program based on the game of WAR. The rules of the game are as follows: The game of WAR is rather simple as it requires only the ability to recognize which of two cards has a higher value. In this game the value of cards from lowest to highest is: 2,3,4,5,6,7,8,9,10,J,Q,K,A No suit has a higher value than another. Both players take the top card off of their pile (stack) and place it face up in the playing area. The player that played the higher card wins the round and takes both cards. If there is a tie, then both players place the next card down and the 3rd card up. The winner of the 3rd card wins the round. If the 3rd cards tie, then both players repeat the process until a player has won the hand. When the player runs out of cards, then the player will shuffle the cards from the winning pile (stack). The game will continue until one play player is completely out cards. This program must be in a graphical format.arrow_forwardWe want a Java program or C++ for an online store (The idea of the program is a shoe store and the seller can display shoe products and know how much of each shoe is sold) #Each shoe has an id, type, price and color # The buyer can see the shoes, add them in the shopping cart, and determine the delivery company and the importance of the order - If the request is urgent, a value of 10 riyals will be added to it for the delivery # When the buyer goes to the shopping bag, the total price of his products is shown to him, and when he confirms the order, he must log in and specify the delivery company and the type of order. Then the final total is calculatedarrow_forward
- Hi, how do we go about solving this problem in Java programming language? Input The input begins with an integer 1 ≤ ? ≤ 10000, the number of frosh. For each frosh, a line follows containing the course numbers of five distinct courses selected by the frosh. Each course number is an integer between 100 and 499. Output The popularity of a combination is the number of frosh selecting exactly the same combination of courses. A combination of courses is considered most popular if no other combination has higher popularity. Output a single line giving the total number of students taking some combination of courses that is most popular.arrow_forwardThis is a Java program but I need a full explaintion on the math part about how to work this problem using algebra or geometry or trigonometry. Thank you a lot. Well, here is the program I need to create based off of your explaintion. The box Problem: You have been given a flat cardboard of area, say 70 square inches , to make an open box by cutting a square from each corner and folding the sides. Your objective is to determinethe dimension, that is, the length and width, and the side of the square to be cut from the corners so that the resulting box is of maximum value. Write a program that prompts the user ro enter the area of the flat cardboard. The progrma then outputs the length and the width of the cardbpard and the length of the side of the square to be cut from the cprner so that the reaulting box is of maximum volume. Calculate your answer to 3 decimal places. Your program must contain a method that takes as input the length and width of the tcardboard and returns the side…arrow_forwardWrite C# a program that simulates rolling five die. Your program should count the number of rolls it takes to get 5 identical values on the dice (five 1s, five 2s, etc.). If you’ve ever played the game Yahtzee, then you are looking for a Yahtzee. Your program should output the values obtained in each run, and then stop when all five have the same value. You should then output the number of rolls it took to get the Yahtzee.arrow_forward
- Write the code in Java language The problem states that there are five philosophers sitting around a circular table. The philosophers must alternatively think and eat. Each philosopher has a bowl of food in front of them, and they require a fork in each hand to eat. However, there are only five forks available. You need to design a solution where each philosopher can eat their food without causing a deadlock.arrow_forwardNeed to handle in javaarrow_forwardJava Only Solution: John's barn has a fence consisting of N consecutive sections numbered from left to right from 1 to N. Each part is first painted in one of two colors: red or green, your information is given with string C. The color of the I-th part Ci will be equal to 'R' if the color of the part is red and 'G' if it is green. John decided to paint the whole fence green. To make the normal drawing process more fun he decided to do it using the following process. Every minute (until the whole fence is painted green) you will do the following steps: Select any part of the phone that is painted red. Let's show the index of this section as X. In each section with references X, X + 1, ..., min (N, X + K - 1), flip the color of the corresponding part from red to green and from green to red by re-painting. John wonders how quickly he can paint the phone. Please help her find the minimum number of minutes needed to repaint. Input: 1 73 RGGRGRG Output: 4arrow_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
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY