Question

Fall 2019 1. Assign each line to a variable and write the passage from Shakespeares Sonnet #52 to console (Careful about lin

We should use “Java” language. Java Eclipse :)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answers:

1.

String line1,line2;

line1="Blessed are you whose worthness gives scope,\n";
line2="Being had, to triumph; being lacked, to hope.";

System.out.println(line1+""+line2);


2.

int width,height;
width=5;
height=5;
System.out.println("Width of rectangle is "+width);
System.out.println("height of rectangle is "+height);

3.

width=4;
height=4;
System.out.println("Width of rectangle is "+width);
System.out.println("height of rectangle is "+height);


4.

System.out.println("Area of rectangle is "+(width*height));


5.

width += 10;
height -= 3;
System.out.println("Area of rectangle is "+(width*height));


6.

byte by1[],by2[];
short s1,s2;
int i1,i2;
long l1, l2;
float f1,f2;
double d1,d2;
char ch1, ch2;
String str1,str2;
boolean b1,b2;


7.

System.out.println(10+(7%3)-12/8);

Program:


public class Program
{
public static void main(String args[])
{
//1.

String line1,line2;

line1="Blessed are you whose worthness gives scope,\n";
line2="Being had, to triumph; being lacked, to hope.";

System.out.println(line1+""+line2);


//2.

int width,height;
width=5;
height=5;
System.out.println("Width of rectangle is "+width);
System.out.println("height of rectangle is "+height);

//3.

width=4;
height=4;
System.out.println("Width of rectangle is "+width);
System.out.println("height of rectangle is "+height);


//4.

System.out.println("Area of rectangle is "+(width*height));


//5.

width += 10;
height -= 3;
System.out.println("Area of rectangle is "+(width*height));


//6.

byte by1[],by2[];
short s1,s2;
int i1,i2;
long l1, l2;
float f1,f2;
double d1,d2;
char ch1, ch2;
String str1,str2;
boolean b1,b2;


//7.

System.out.println("10+(7%3)-12/8 = "+(10+(7%3)-12/8));
}
}

Quick Access Task List - - eclipse-workspace - JavaFX/src/Program java - Eclipse IDE File Edit Source Refactor Navigate Searc

Add a comment
Know the answer?
Add Answer to:
We should use “Java” language. Java Eclipse :) Fall 2019 1. Assign each line to a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA 1. Write a class called Rectangle that represents a rectangular two-dimensional region. Your Rectangle objects...

    JAVA 1. Write a class called Rectangle that represents a rectangular two-dimensional region. Your Rectangle objects should have the following fields and methods: int width, int height Where width and height are the dimensions of the rectangle. Write accessor methods (i.e. getWidth(), getHeight()) that retrieve the values stored in the fields above. And mutator methods (i.e. setWidthl), setHeight() ) that change the field's values. Finally create a method called getAreal) that returns the area of the rectangle. Like we did...

  • /*hello everyone. my question is mostly related to the garagetest part of this assignment that i've...

    /*hello everyone. my question is mostly related to the garagetest part of this assignment that i've been working on. i am not sure how to read the file's contents AND put them into variables/an array. should it be in an arraylist? or maybe a regular array? or no arrays at all? i am also not sure how to call the factory method from garagec. i'm thinking something along the lines of [Garage garage = new GarageC.getInstance("GarageC", numFloors, areaofEachFloor);] but i...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT