Write a Java program that displays the following “picture” .

INFS2151: Intro Java Programming
Homework 1
Due Wednesday, Jan 25 11:59pm
1. (5 pts) Identify and correct the error(s) in the following code:
1 package HW1;
2
3 public c l a s s Welcome ( ) {
4 public S t a t i c void main ( S t r i n g a r g s [ ] ) {
5 System . out . p r i n t l n ( Java i s f u n ! ) ;
6 }
7 }
2. (5 pts) Joaquin wrote the following code. It compiles and runs but does not behave as expected. It is supposed to calculate the perimeter of a rectangle with given x and y side measurements. What does it actually do?
1 package HW1;
2 import j a v a . u t i l . S c a n n e r ;
3
4 public c l a s s CalcPerim {
5
6 public s t a t i c void main ( S t r i n g [ ] a r g s ) {
7 double x , y ;
8 System . out . p r i n t l n ( “ Enter r e c t a n g l e s i d e measurements ” ) ;
9 S c a n n e r i n p u t = new S c a n n e r ( System . i n ) ;
10 x = i n p u t . nextDouble ( ) ;
11 y = i n p u t . nextDouble ( ) ;
12
13 double r e s u l t = 2 ∗ x + y ;
14 System . out . p r i n t l n ( “ P e r i m t e r i s ” + r e s u l t ) ;
15 }
16
17 }
3. (10 pts) Write a Java program that displays the following “picture” .
4. (10 pts) Currently, one US dollar (USD) is equal to 128.66 Japanese yen (JPY). Using this conversion, write a program that will convert a given dollar value to yen. E.g., the user will input a value in USD and the program will output the equivalent value in JPY. Keep in mind that your program should prompt the user for input, do the conversion, and print the result.
5. (20 pts) Tip calculator: Write a Java program that takes two user inputs, the bill amount and the tip percentage, and outputs the amount to tip as well as the total. For example, if the bill amount is $25 and the tip percentage is 20%, the tip would be $5 and total would be $30. Be sure to prompt the user for input and meaningfully display the result.

© 2020 EssayQuoll.com. All Rights Reserved. | Disclaimer: For assistance purposes only. These custom papers should be used with proper reference.