SlideShare uma empresa Scribd logo
1 de 4
Java programing | Electronic Engineering homework help
This homework assignment is due on Wednesday, September 13, 2017 at 12:00 PM (noon),
and will be accepted than 5:00 PM on the same day.On page 25 of Big Java: Late Objects,
complete the following Review Exercises:R1.7 What does this program print?public class
Test{ public static void main(String[] args) { System.out.println(“39 +
3”); System.out.println(39 + 3); }} R1.7 What does this program print?public class
Test{ public static void main(String[] args) { System.out.println(“39 +
3”); System.out.println(39 + 3); }} R1.9 What is the compile-time error in this
program?public class Test{ public static void main(String[]
args) { System.out.println(“Hello”, “World!”); }} R1.13 Write an algorithm to settle the
following question: A bank account starts out with $10,000. Interest is compounded
monthly at 6 percent per year (0.5 percent per month). Every month, $500 is withdrawn to
meet college expenses. After how many years is the account depleted?Use the Design Recipe
to develop this algorithm. R1.14 Consider the question in Exercise R1.13. Suppose the
numbers ($10,000, 6 percent, $500) were user selectable. Are there values for which the
algorithm you developed would not terminate? If so, change the algorithm to make sure it
always terminates. R1.15 In order to estimate the cost of painting a house, a painter needs
to know the surface area of the exterior. Develop an algorithm for computing that value.
Your inputs are the width, length, and height of the house, the number of windows and
doors, and their dimensions. (Assume the windows and doors have a uniform size.) R1.19
The ancient Babylonians had an algorithm for determining the square root of a number a.
Start with an initial guess of a / 2. Then find the average of your guess g and a / g. That’s
your next guess. Repeat until two consecutive guesses are close enough. Write pseudocode
for this algorithm.On pages 26-27 of Big Java: Late Objects, complete the following Practice
Exercises:E1.1 Write a program that prints a greeting of your choice, perhaps in a language
other than English. E1.4 Write a program that prints the balance of an account after the first,
second, and third year. The account has an initial balance of $1,000 and earns 5 percent
interest per year. E1.5 Write a program that displays your name inside a box on the
screen. Do your best to approximate lines with characters such as | – +. E1.6 Write a
program that prints your name in large letters, such
as* * ** **** **** * ** * * * * * * * * ****** * * **** **** *
** * ****** * * * * ** * * * * * * * *E1.7 Write a program that prints your name
in Morse code, like this:…. .- .-. .-. -.–Use a separate call to System.out.print for each
letter. E1.8 Write a program that prints a face similar to (but different from) the
following: ///// +”””””+ (| o o |) | ^ | | ‘-‘ | +—–+E1.10W rite a program that prints a
house that looks exactly like the following: + + + + + +—–+ | .-. | | | | | +-+-+-
+ E1.11 Write a program that prints an animal speaking a greeting, similar to (but different
from) the following: /_/ —–( ‘ ‘ ) / Hello( – ) < Junior | | | | Coder!/ E1.13 Write a
program that prints a poem of your choice. If you don’t have a favorite poem, search the
Internet for “Emily Dickinson” or “e e cummings” E1.15 Type in and run the following
program. Then modify it to show the message “Hello, your name!”.import
javax.swing.JOptionPane;public class DialogViewer{ public static void main(String[]
args) { JOptionPane.showMessageDialog(null, “Hello, World!”); }} E1.16 Type in and
run the following program. Then modify it to print “Hello, name!”, displaying the name that
the user typed in.import javax.swing.JOptionPane;public class DialogViewer{ public static
void main(String[] args) { String name = JOptionPane.showInputDialog(“What is your
name?”); System.out.println(name); }}E1.17 (OPTIONAL) Modify the program from
Exercise E1.16 so that the dialog continues with the message “My name is Hal! What would
you like me to do?” Discard the user’s input and display a message such asI’m sorry, Dave.
I’m afraid I can’t do that.Replace Dave with the name that was provided by the user.E1.18
Type in and run the following program. Then modify it to show a different greeting and
image.import java.net.URL;import javax.swing.ImageIcon;import
javax.swing.JOptionPane;public class Test{ public static void main(String[] args) throws
Exception { URL imageLocation = new
URL( “http://horstmann.com/java4everyone/duke.gif”); JOptionPane.showMessag
eDialog(null, “Hello”, “Title”, JOptionPane.PLAIN_MESSAGE, new
ImageIcon(imageLocation)); }}On pages 71-73 of Big Java: Late Objects, complete the
following Review Exercises:R2.1 Write declarations for storing the following quantities.
Choose between integers and floating-point numbers. Declare constants when
appropriate.a. The number of days per weekb. The number of days until the end of the
semesterc. The number of centimeters in an inchd. The height of the tallest person in your
class, in centimetersR2.2 What is the value of mystery after this sequence of statements?int
mystery = 1;mystery = 1 – 2 * mystery;mystery = mystery + 1;R2.3 What is wrong with the
following sequence of statements?int mystery = 1;mystery = mystery + 1;int mystery = 1 – 2
* mystery;R2.4 Write the following mathematical expressions in Java.R2.5 Write the
following Java expressions in mathematical notation.a. dm = m * (Math.sqrt(1 + v / c) /
Math.sqrt(1 – v / c) – 1);b. volume = Math.PI * r * r * h;c. volume = 4 * Math.PI * Math.pow(r,
3) / 3;d. z = Math.sqrt(x * x + y * y);R2.6 What are the values of the following expressions?
In each line, assume thatdouble x = 2.5;double y = -1.5;int m = 18;int n = 4;a. x + n * y – (x +
n) * yb. m / n + m % nc. 5 * x – n / 5d. 1 – (1 – (1 – (1 – (1 – n))))e.
Math.sqrt(Math.sqrt(n))R2.7 What are the values of the following expressions, assuming
that n and m have type int, n is 17, and m is 18?a. n / 10 + n % 10b. n % 2 + m % 2c. (m + n)
/ 2d. (m + n) / 2.0e. (int) (0.5 * (m + n))f. (int) Math.round(0.5 * (m + n))R2.8 What are the
values of the following expressions? In each line, assume thatString s = “Hello”;String t =
“World”;a. s.length() + t.length()b. s.substring(1, 2)c. s.substring(s.length() / 2, s.length())d.
s + te. t + sR2.11 Find at least five compile-time errors in the following program.public class
HasErrors{ public static void main(); { System.out.print(Please enter two
numbers:) x = in.readDouble; y = in.readDouble; System.out.printline(“The sum is ”
+ x + y); }}R2.12 Find three run-time errors in the following program.public class
HasErrors{ public static void main(String[] args) { int x = 0; int y = 0; Scanner in =
new Scanner(“System.in”); System.out.print(“Please enter an integer:”); x =
in.readInt(); System.out.print(“Please enter another integer: “); x =
in.readInt(); System.out.println(“The sum is ” + x + y); }}R2.13 Consider the following
code segment.double purchase = 19.93;double payment = 20.00;double change = payment –
purchase;System.out.println(change);The code segment prints the change as
0.07000000000000028. Explain why. Give a recommendation to improve the code so that
users will not be confused. R2.14 Explain the differences between 2, 2.0, ‘2’, “2”, and
“2.0”.R2.15 Explain what each of the following program segments computes.a. x = 2; y = x +
x;b. s = “2”; t = s + s;R2.18 Write pseudocode for a program that computes the first and last
digit of a number. For example, if the input is 23456, the program should print 2 and 6. Hint:
%, Math.log10. R2.19 Modify the pseudocode for the program in How To 2.1 so that the
program gives change in quarters, dimes, and nickels. You can assume that the price is a
multiple of 5 cents. To develop your pseudocode, first work with a couple of specific
values. R2.20 A cocktail shaker is composed of three cone sections.Using realistic values for
the radii and heights, compute the total volume, using the formula given in Self Check 25 for
a cone section. Then develop an algorithm that works for arbitrary dimensions. R2.21 You
are cutting off a piece of pie like this, where c is the length of the straight part (called the
chord length) and h is the height of the piece.There is an approximate formula for the area:
However, h is not so easy to measure, whereas the diameter d of a pie is usually well-
known. Calculate the area where the diameter of the pie is 12 inches and the chord length of
the segment is 10 inches. Generalize to an algorithm that yields the area for any diameter
and chord length. R2.25 For each of the following computations in Java, determine whether
the result is exact, an overflow, or a roundoff error.a. 2.0 – 1.1b. 1.0E6 * 1.0E6c. 65536 *
65536d. 1_000_000L * 1_000_000LR2.26 Write a program that prints the values3 * 1000 *
1000 * 10003.0 * 1000 * 1000 * 1000Explain the results. R2.27 This chapter contains a
number of recommendations regarding variables and constants that make programs easier
to read and maintain. Briefly summarize these recommendations. On pages 75-76 of Big
Java: Late Objects, complete the following Practice Exercises:E2.1 Write a program that
displays the dimensions of a letter-size (8.5 × 11 inches) sheet of paper in millimeters.
There are 25.4 millimeters per inch. Use constants and comments in your program. E2.2
Write a program that computes and displays the perimeter of a letter-size (8.5 × 11 inches)
sheet of paper and the length of its diagonal. E2.3 Write a program that reads a number and
displays the square, cube, and fourth power. Use the Math.pow method only for the fourth
power. E2.4 Write a program that prompts the user for two integers and then prints E2.5
Enhance the output of Exercise E2.4 so that the numbers are properly
aligned:Sum: 45Difference: -
5Product: 500Average: 22.50Distance: 5Maximum: 25Minimum: 20E2.
6 Write a program that prompts the user for a measurement in meters and then converts it
to miles, feet, and inches. E2.7 Write a program that prompts the user for a radius and then
prints The area and circumference of a circle with that radiusThe volume and surface area
of a sphere with that radius E2.8 Write a program that asks the user for the lengths of the
sides of a rectangle. Then print The area and perimeter of the rectangleThe length of the
diagonal (use the Pythagorean theorem) E2.9 Improve the program discussed in How To 2.1
to allow input of quarters in addition to bills. E2.10 Write a program that helps a person
decide whether to buy a hybrid car. Your program’s inputs should be: The cost of a new
carThe estimated miles driven per yearThe estimated gas priceThe efficiency in miles per
gallonThe estimated resale value after 5 yearsCompute the total cost of owning the car for
five years. (For simplicity, we will not take the cost of financing into account.) Obtain
realistic prices for a new and used hybrid and a comparable car from the Web. Run your
program twice, using today’s gas price and 15,000 miles per year. Include pseudocode and
the program runs with your assignment. E2.11 Write a program that asks the user to
input E2.14 Write a program that reads a number between 1,000 and 999,999 from the user
and prints it with a comma separating the thousands. Here is a sample dialog; the user input
is in color:Please enter an integer between 1000 and 999999: 2345623,456E2.16 Write a
program that reads in an integer and breaks it into a sequence of individual digits. For
example, the input 16384 is displayed as1 6 3 8 4You may assume that the input has no
more than five digits and is not negative. E2.17 Write a program that reads two times in
military format (0900, 1730) and prints the number of hours and minutes between the two
times. Here is a sample run. User input is in color.Please enter the first time: 0900Please
enter the second time: 17308 hours 30 minutesWhat Do I Hand In?Once you are done,
submit your answers as any one of:MS Word document (.docx or .doc file) Rich Text Format
document (.rtf file) PDF document Plain text document (.txt or .text file)

Mais conteúdo relacionado

Semelhante a Java programing Electronic Engineering homework help.docx

Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.comHarrisGeorg21
 
Java Question-Bank-Class-8.pdf
Java Question-Bank-Class-8.pdfJava Question-Bank-Class-8.pdf
Java Question-Bank-Class-8.pdfAditya Kumar
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.comjonhson300
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comjonhson129
 
GSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comGSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comagathachristie281
 
GSP 215 RANK Education Counseling--gsp215rank.com
 GSP 215 RANK Education Counseling--gsp215rank.com GSP 215 RANK Education Counseling--gsp215rank.com
GSP 215 RANK Education Counseling--gsp215rank.comwilliamwordsworth40
 
GSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comGSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comWindyMiller12
 
Oop lab assignment 01
Oop lab assignment 01Oop lab assignment 01
Oop lab assignment 01Drjilesh
 
GSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comGSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comkopiko85
 
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...Dadangsachir WANDA ir.mba
 
JavaScript Full-Stack Development Course Session 01
JavaScript Full-Stack Development Course Session 01JavaScript Full-Stack Development Course Session 01
JavaScript Full-Stack Development Course Session 01Basir Jafarzadeh
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEWshyamuopeight
 
Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.comStokesCope20
 
CSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.pptCSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.pptRashedurRahman18
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 
M150 A Fall2010 T01
M150 A Fall2010 T01M150 A Fall2010 T01
M150 A Fall2010 T01abdalodainat
 

Semelhante a Java programing Electronic Engineering homework help.docx (19)

Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.com
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
Java Question-Bank-Class-8.pdf
Java Question-Bank-Class-8.pdfJava Question-Bank-Class-8.pdf
Java Question-Bank-Class-8.pdf
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.com
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.com
 
GSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comGSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.com
 
GSP 215 RANK Education Counseling--gsp215rank.com
 GSP 215 RANK Education Counseling--gsp215rank.com GSP 215 RANK Education Counseling--gsp215rank.com
GSP 215 RANK Education Counseling--gsp215rank.com
 
GSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comGSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.com
 
Oop lab assignment 01
Oop lab assignment 01Oop lab assignment 01
Oop lab assignment 01
 
ELAVARASAN.pdf
ELAVARASAN.pdfELAVARASAN.pdf
ELAVARASAN.pdf
 
GSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comGSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.com
 
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
 
JavaScript Full-Stack Development Course Session 01
JavaScript Full-Stack Development Course Session 01JavaScript Full-Stack Development Course Session 01
JavaScript Full-Stack Development Course Session 01
 
Getting started with R
Getting started with RGetting started with R
Getting started with R
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
 
Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.com
 
CSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.pptCSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.ppt
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
M150 A Fall2010 T01
M150 A Fall2010 T01M150 A Fall2010 T01
M150 A Fall2010 T01
 

Mais de stirlingvwriters

Speak to the idea of feminism from your perspective and.docx
Speak to the idea of feminism from your perspective and.docxSpeak to the idea of feminism from your perspective and.docx
Speak to the idea of feminism from your perspective and.docxstirlingvwriters
 
What is the logic behind How.docx
What is the logic behind How.docxWhat is the logic behind How.docx
What is the logic behind How.docxstirlingvwriters
 
Thinking about password identify two that you believe are.docx
Thinking about password identify two that you believe are.docxThinking about password identify two that you believe are.docx
Thinking about password identify two that you believe are.docxstirlingvwriters
 
The student will demonstrate and articulate proficiency in.docx
The student will demonstrate and articulate proficiency in.docxThe student will demonstrate and articulate proficiency in.docx
The student will demonstrate and articulate proficiency in.docxstirlingvwriters
 
To help lay the foundation for your study of postmodern.docx
To help lay the foundation for your study of postmodern.docxTo help lay the foundation for your study of postmodern.docx
To help lay the foundation for your study of postmodern.docxstirlingvwriters
 
TITLE Digital marketing before and after pandemic Sections that.docx
TITLE Digital marketing before and after pandemic Sections that.docxTITLE Digital marketing before and after pandemic Sections that.docx
TITLE Digital marketing before and after pandemic Sections that.docxstirlingvwriters
 
This assignment focuses on Marxist students will educate.docx
This assignment focuses on Marxist students will educate.docxThis assignment focuses on Marxist students will educate.docx
This assignment focuses on Marxist students will educate.docxstirlingvwriters
 
There are many possible sources of literature for.docx
There are many possible sources of literature for.docxThere are many possible sources of literature for.docx
There are many possible sources of literature for.docxstirlingvwriters
 
You enter your project team meeting with Mike and Tiffany.docx
You enter your project team meeting with Mike and Tiffany.docxYou enter your project team meeting with Mike and Tiffany.docx
You enter your project team meeting with Mike and Tiffany.docxstirlingvwriters
 
Write a minimum of 200 words response to each post.docx
Write a minimum of 200 words response to each post.docxWrite a minimum of 200 words response to each post.docx
Write a minimum of 200 words response to each post.docxstirlingvwriters
 
View the video on Law at Discuss various.docx
View the video on Law at Discuss various.docxView the video on Law at Discuss various.docx
View the video on Law at Discuss various.docxstirlingvwriters
 
Your software has gone live and is in the production.docx
Your software has gone live and is in the production.docxYour software has gone live and is in the production.docx
Your software has gone live and is in the production.docxstirlingvwriters
 
This learning was a cornucopia of enrichment with regard.docx
This learning was a cornucopia of enrichment with regard.docxThis learning was a cornucopia of enrichment with regard.docx
This learning was a cornucopia of enrichment with regard.docxstirlingvwriters
 
This is a school community relations My chosen school.docx
This is a school community relations My chosen school.docxThis is a school community relations My chosen school.docx
This is a school community relations My chosen school.docxstirlingvwriters
 
Write 3 Only one resource is I.docx
Write 3 Only one resource is I.docxWrite 3 Only one resource is I.docx
Write 3 Only one resource is I.docxstirlingvwriters
 
Sociology researches social issues through the use of theoretical.docx
Sociology researches social issues through the use of theoretical.docxSociology researches social issues through the use of theoretical.docx
Sociology researches social issues through the use of theoretical.docxstirlingvwriters
 
Step Listen to the Trail of Tears.docx
Step Listen to the Trail of Tears.docxStep Listen to the Trail of Tears.docx
Step Listen to the Trail of Tears.docxstirlingvwriters
 
You are the newly hired Director of Risk Management for.docx
You are the newly hired Director of Risk Management for.docxYou are the newly hired Director of Risk Management for.docx
You are the newly hired Director of Risk Management for.docxstirlingvwriters
 

Mais de stirlingvwriters (20)

Speak to the idea of feminism from your perspective and.docx
Speak to the idea of feminism from your perspective and.docxSpeak to the idea of feminism from your perspective and.docx
Speak to the idea of feminism from your perspective and.docx
 
What is the logic behind How.docx
What is the logic behind How.docxWhat is the logic behind How.docx
What is the logic behind How.docx
 
Thinking about password identify two that you believe are.docx
Thinking about password identify two that you believe are.docxThinking about password identify two that you believe are.docx
Thinking about password identify two that you believe are.docx
 
The student will demonstrate and articulate proficiency in.docx
The student will demonstrate and articulate proficiency in.docxThe student will demonstrate and articulate proficiency in.docx
The student will demonstrate and articulate proficiency in.docx
 
To help lay the foundation for your study of postmodern.docx
To help lay the foundation for your study of postmodern.docxTo help lay the foundation for your study of postmodern.docx
To help lay the foundation for your study of postmodern.docx
 
TITLE Digital marketing before and after pandemic Sections that.docx
TITLE Digital marketing before and after pandemic Sections that.docxTITLE Digital marketing before and after pandemic Sections that.docx
TITLE Digital marketing before and after pandemic Sections that.docx
 
This assignment focuses on Marxist students will educate.docx
This assignment focuses on Marxist students will educate.docxThis assignment focuses on Marxist students will educate.docx
This assignment focuses on Marxist students will educate.docx
 
Upton Souls of Black.docx
Upton Souls of Black.docxUpton Souls of Black.docx
Upton Souls of Black.docx
 
What is a In this.docx
What is a In this.docxWhat is a In this.docx
What is a In this.docx
 
There are many possible sources of literature for.docx
There are many possible sources of literature for.docxThere are many possible sources of literature for.docx
There are many possible sources of literature for.docx
 
You enter your project team meeting with Mike and Tiffany.docx
You enter your project team meeting with Mike and Tiffany.docxYou enter your project team meeting with Mike and Tiffany.docx
You enter your project team meeting with Mike and Tiffany.docx
 
Write a minimum of 200 words response to each post.docx
Write a minimum of 200 words response to each post.docxWrite a minimum of 200 words response to each post.docx
Write a minimum of 200 words response to each post.docx
 
View the video on Law at Discuss various.docx
View the video on Law at Discuss various.docxView the video on Law at Discuss various.docx
View the video on Law at Discuss various.docx
 
Your software has gone live and is in the production.docx
Your software has gone live and is in the production.docxYour software has gone live and is in the production.docx
Your software has gone live and is in the production.docx
 
This learning was a cornucopia of enrichment with regard.docx
This learning was a cornucopia of enrichment with regard.docxThis learning was a cornucopia of enrichment with regard.docx
This learning was a cornucopia of enrichment with regard.docx
 
This is a school community relations My chosen school.docx
This is a school community relations My chosen school.docxThis is a school community relations My chosen school.docx
This is a school community relations My chosen school.docx
 
Write 3 Only one resource is I.docx
Write 3 Only one resource is I.docxWrite 3 Only one resource is I.docx
Write 3 Only one resource is I.docx
 
Sociology researches social issues through the use of theoretical.docx
Sociology researches social issues through the use of theoretical.docxSociology researches social issues through the use of theoretical.docx
Sociology researches social issues through the use of theoretical.docx
 
Step Listen to the Trail of Tears.docx
Step Listen to the Trail of Tears.docxStep Listen to the Trail of Tears.docx
Step Listen to the Trail of Tears.docx
 
You are the newly hired Director of Risk Management for.docx
You are the newly hired Director of Risk Management for.docxYou are the newly hired Director of Risk Management for.docx
You are the newly hired Director of Risk Management for.docx
 

Último

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 

Último (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 

Java programing Electronic Engineering homework help.docx

  • 1. Java programing | Electronic Engineering homework help This homework assignment is due on Wednesday, September 13, 2017 at 12:00 PM (noon), and will be accepted than 5:00 PM on the same day.On page 25 of Big Java: Late Objects, complete the following Review Exercises:R1.7 What does this program print?public class Test{ public static void main(String[] args) { System.out.println(“39 + 3”); System.out.println(39 + 3); }} R1.7 What does this program print?public class Test{ public static void main(String[] args) { System.out.println(“39 + 3”); System.out.println(39 + 3); }} R1.9 What is the compile-time error in this program?public class Test{ public static void main(String[] args) { System.out.println(“Hello”, “World!”); }} R1.13 Write an algorithm to settle the following question: A bank account starts out with $10,000. Interest is compounded monthly at 6 percent per year (0.5 percent per month). Every month, $500 is withdrawn to meet college expenses. After how many years is the account depleted?Use the Design Recipe to develop this algorithm. R1.14 Consider the question in Exercise R1.13. Suppose the numbers ($10,000, 6 percent, $500) were user selectable. Are there values for which the algorithm you developed would not terminate? If so, change the algorithm to make sure it always terminates. R1.15 In order to estimate the cost of painting a house, a painter needs to know the surface area of the exterior. Develop an algorithm for computing that value. Your inputs are the width, length, and height of the house, the number of windows and doors, and their dimensions. (Assume the windows and doors have a uniform size.) R1.19 The ancient Babylonians had an algorithm for determining the square root of a number a. Start with an initial guess of a / 2. Then find the average of your guess g and a / g. That’s your next guess. Repeat until two consecutive guesses are close enough. Write pseudocode for this algorithm.On pages 26-27 of Big Java: Late Objects, complete the following Practice Exercises:E1.1 Write a program that prints a greeting of your choice, perhaps in a language other than English. E1.4 Write a program that prints the balance of an account after the first, second, and third year. The account has an initial balance of $1,000 and earns 5 percent interest per year. E1.5 Write a program that displays your name inside a box on the screen. Do your best to approximate lines with characters such as | – +. E1.6 Write a program that prints your name in large letters, such as* * ** **** **** * ** * * * * * * * * ****** * * **** **** * ** * ****** * * * * ** * * * * * * * *E1.7 Write a program that prints your name in Morse code, like this:…. .- .-. .-. -.–Use a separate call to System.out.print for each letter. E1.8 Write a program that prints a face similar to (but different from) the
  • 2. following: ///// +”””””+ (| o o |) | ^ | | ‘-‘ | +—–+E1.10W rite a program that prints a house that looks exactly like the following: + + + + + +—–+ | .-. | | | | | +-+-+- + E1.11 Write a program that prints an animal speaking a greeting, similar to (but different from) the following: /_/ —–( ‘ ‘ ) / Hello( – ) < Junior | | | | Coder!/ E1.13 Write a program that prints a poem of your choice. If you don’t have a favorite poem, search the Internet for “Emily Dickinson” or “e e cummings” E1.15 Type in and run the following program. Then modify it to show the message “Hello, your name!”.import javax.swing.JOptionPane;public class DialogViewer{ public static void main(String[] args) { JOptionPane.showMessageDialog(null, “Hello, World!”); }} E1.16 Type in and run the following program. Then modify it to print “Hello, name!”, displaying the name that the user typed in.import javax.swing.JOptionPane;public class DialogViewer{ public static void main(String[] args) { String name = JOptionPane.showInputDialog(“What is your name?”); System.out.println(name); }}E1.17 (OPTIONAL) Modify the program from Exercise E1.16 so that the dialog continues with the message “My name is Hal! What would you like me to do?” Discard the user’s input and display a message such asI’m sorry, Dave. I’m afraid I can’t do that.Replace Dave with the name that was provided by the user.E1.18 Type in and run the following program. Then modify it to show a different greeting and image.import java.net.URL;import javax.swing.ImageIcon;import javax.swing.JOptionPane;public class Test{ public static void main(String[] args) throws Exception { URL imageLocation = new URL( “http://horstmann.com/java4everyone/duke.gif”); JOptionPane.showMessag eDialog(null, “Hello”, “Title”, JOptionPane.PLAIN_MESSAGE, new ImageIcon(imageLocation)); }}On pages 71-73 of Big Java: Late Objects, complete the following Review Exercises:R2.1 Write declarations for storing the following quantities. Choose between integers and floating-point numbers. Declare constants when appropriate.a. The number of days per weekb. The number of days until the end of the semesterc. The number of centimeters in an inchd. The height of the tallest person in your class, in centimetersR2.2 What is the value of mystery after this sequence of statements?int mystery = 1;mystery = 1 – 2 * mystery;mystery = mystery + 1;R2.3 What is wrong with the following sequence of statements?int mystery = 1;mystery = mystery + 1;int mystery = 1 – 2 * mystery;R2.4 Write the following mathematical expressions in Java.R2.5 Write the following Java expressions in mathematical notation.a. dm = m * (Math.sqrt(1 + v / c) / Math.sqrt(1 – v / c) – 1);b. volume = Math.PI * r * r * h;c. volume = 4 * Math.PI * Math.pow(r, 3) / 3;d. z = Math.sqrt(x * x + y * y);R2.6 What are the values of the following expressions? In each line, assume thatdouble x = 2.5;double y = -1.5;int m = 18;int n = 4;a. x + n * y – (x + n) * yb. m / n + m % nc. 5 * x – n / 5d. 1 – (1 – (1 – (1 – (1 – n))))e. Math.sqrt(Math.sqrt(n))R2.7 What are the values of the following expressions, assuming that n and m have type int, n is 17, and m is 18?a. n / 10 + n % 10b. n % 2 + m % 2c. (m + n) / 2d. (m + n) / 2.0e. (int) (0.5 * (m + n))f. (int) Math.round(0.5 * (m + n))R2.8 What are the values of the following expressions? In each line, assume thatString s = “Hello”;String t = “World”;a. s.length() + t.length()b. s.substring(1, 2)c. s.substring(s.length() / 2, s.length())d. s + te. t + sR2.11 Find at least five compile-time errors in the following program.public class HasErrors{ public static void main(); { System.out.print(Please enter two
  • 3. numbers:) x = in.readDouble; y = in.readDouble; System.out.printline(“The sum is ” + x + y); }}R2.12 Find three run-time errors in the following program.public class HasErrors{ public static void main(String[] args) { int x = 0; int y = 0; Scanner in = new Scanner(“System.in”); System.out.print(“Please enter an integer:”); x = in.readInt(); System.out.print(“Please enter another integer: “); x = in.readInt(); System.out.println(“The sum is ” + x + y); }}R2.13 Consider the following code segment.double purchase = 19.93;double payment = 20.00;double change = payment – purchase;System.out.println(change);The code segment prints the change as 0.07000000000000028. Explain why. Give a recommendation to improve the code so that users will not be confused. R2.14 Explain the differences between 2, 2.0, ‘2’, “2”, and “2.0”.R2.15 Explain what each of the following program segments computes.a. x = 2; y = x + x;b. s = “2”; t = s + s;R2.18 Write pseudocode for a program that computes the first and last digit of a number. For example, if the input is 23456, the program should print 2 and 6. Hint: %, Math.log10. R2.19 Modify the pseudocode for the program in How To 2.1 so that the program gives change in quarters, dimes, and nickels. You can assume that the price is a multiple of 5 cents. To develop your pseudocode, first work with a couple of specific values. R2.20 A cocktail shaker is composed of three cone sections.Using realistic values for the radii and heights, compute the total volume, using the formula given in Self Check 25 for a cone section. Then develop an algorithm that works for arbitrary dimensions. R2.21 You are cutting off a piece of pie like this, where c is the length of the straight part (called the chord length) and h is the height of the piece.There is an approximate formula for the area: However, h is not so easy to measure, whereas the diameter d of a pie is usually well- known. Calculate the area where the diameter of the pie is 12 inches and the chord length of the segment is 10 inches. Generalize to an algorithm that yields the area for any diameter and chord length. R2.25 For each of the following computations in Java, determine whether the result is exact, an overflow, or a roundoff error.a. 2.0 – 1.1b. 1.0E6 * 1.0E6c. 65536 * 65536d. 1_000_000L * 1_000_000LR2.26 Write a program that prints the values3 * 1000 * 1000 * 10003.0 * 1000 * 1000 * 1000Explain the results. R2.27 This chapter contains a number of recommendations regarding variables and constants that make programs easier to read and maintain. Briefly summarize these recommendations. On pages 75-76 of Big Java: Late Objects, complete the following Practice Exercises:E2.1 Write a program that displays the dimensions of a letter-size (8.5 × 11 inches) sheet of paper in millimeters. There are 25.4 millimeters per inch. Use constants and comments in your program. E2.2 Write a program that computes and displays the perimeter of a letter-size (8.5 × 11 inches) sheet of paper and the length of its diagonal. E2.3 Write a program that reads a number and displays the square, cube, and fourth power. Use the Math.pow method only for the fourth power. E2.4 Write a program that prompts the user for two integers and then prints E2.5 Enhance the output of Exercise E2.4 so that the numbers are properly aligned:Sum: 45Difference: - 5Product: 500Average: 22.50Distance: 5Maximum: 25Minimum: 20E2. 6 Write a program that prompts the user for a measurement in meters and then converts it to miles, feet, and inches. E2.7 Write a program that prompts the user for a radius and then prints The area and circumference of a circle with that radiusThe volume and surface area
  • 4. of a sphere with that radius E2.8 Write a program that asks the user for the lengths of the sides of a rectangle. Then print The area and perimeter of the rectangleThe length of the diagonal (use the Pythagorean theorem) E2.9 Improve the program discussed in How To 2.1 to allow input of quarters in addition to bills. E2.10 Write a program that helps a person decide whether to buy a hybrid car. Your program’s inputs should be: The cost of a new carThe estimated miles driven per yearThe estimated gas priceThe efficiency in miles per gallonThe estimated resale value after 5 yearsCompute the total cost of owning the car for five years. (For simplicity, we will not take the cost of financing into account.) Obtain realistic prices for a new and used hybrid and a comparable car from the Web. Run your program twice, using today’s gas price and 15,000 miles per year. Include pseudocode and the program runs with your assignment. E2.11 Write a program that asks the user to input E2.14 Write a program that reads a number between 1,000 and 999,999 from the user and prints it with a comma separating the thousands. Here is a sample dialog; the user input is in color:Please enter an integer between 1000 and 999999: 2345623,456E2.16 Write a program that reads in an integer and breaks it into a sequence of individual digits. For example, the input 16384 is displayed as1 6 3 8 4You may assume that the input has no more than five digits and is not negative. E2.17 Write a program that reads two times in military format (0900, 1730) and prints the number of hours and minutes between the two times. Here is a sample run. User input is in color.Please enter the first time: 0900Please enter the second time: 17308 hours 30 minutesWhat Do I Hand In?Once you are done, submit your answers as any one of:MS Word document (.docx or .doc file) Rich Text Format document (.rtf file) PDF document Plain text document (.txt or .text file)