❓ Help Çℎḙḡḡ need help

Status
Not open for further replies.

Itachi03

Forum Veteran
mga boss spbrang need lang ngayon. baka po may makahelp dyan sa may mga access sa Çℎḙḡḡ
https://www.Çℎḙḡḡ.com/homework-help...lication-show-u-group-multiplicatio-q63387148
salamat po sa makakatulongg
 
[XX='Renzo_Tino, c: 560661, m: 1796307'][/XX]
import java.util.Scanner;

public class Printing {

public static void main(String[] args) {

// Constants

final int ONE_INCH = 72;

final char DOUBLE_LOWER = 'd';

final char DOUBLE_UPPER = 'D';

final char SINGLE_LOWER = 's';

final char SINGLE_UPPER = 'S';

// input fields accept from user

char space = 0;

double length = 0;

double width = 0;

double leftMargin = 0;

double rightMargin = 0;

double topMargin = 0;

double bottomMargin = 0;

double pointSize = 0;

int totalCharacters = 0;

int totalLines = 0;

int finalLength = 0;

double finalWidth = 0;

int pointsLength = 0;

double pointsWidth = 0;

Scanner sc = new Scanner(System.in);

System.out.println("Enter the length of the paper:");

length = sc.nextDouble();

System.out.println("Enter the width of the paper:");

width = sc.nextDouble();

System.out.println("Enter the left margin of the paper:");

leftMargin = sc.nextDouble();

System.out.println("Enter the right margin of the paper:");

rightMargin = sc.nextDouble();

System.out.println("Enter the top margin of the paper:");

topMargin = sc.nextDouble();

System.out.println("Enter the bottom margin of the paper:");

bottomMargin = sc.nextDouble();

System.out.println("Enter the point size of the paper:");

pointSize = sc.nextDouble();

System.out

.println("Enterline spacing,s or S (Single spaced),d or D (Double spaced):");

String lineSpace = sc.next();

space = lineSpace.charAt(0);

finalLength = (int) (length - (topMargin + bottomMargin));

finalWidth = width - (leftMargin + rightMargin);

pointsLength = finalLength * ONE_INCH;

pointsWidth = finalWidth * ONE_INCH;

if (space == DOUBLE_UPPER || space == DOUBLE_LOWER) {

pointSize += pointSize;

totalLines = (int) (pointsLength / pointSize);

totalCharacters = (int) (pointsWidth / pointSize);

System.out.println("The number of lines that can be printed : "

+ totalLines);

System.out

.println("The number of characters that can be printed in a line: "

+ totalCharacters);

} else if (space == SINGLE_UPPER || space == SINGLE_LOWER) {

totalLines = (int) (pointsLength / pointSize);

totalCharacters = (int) (pointsWidth / pointSize);

System.out.println("The number of lines that can be printed : "

+ totalLines);

System.out

.println("The number of characters that can be printed in a line: "

+ totalCharacters);

}

sc.close();

}

}

Output:

Enter the length of the paper:

11

Enter the width of the paper:

8.5

Enter the left margin of the paper:

1

Enter the right margin of the paper:

1

Enter the top margin of the paper:

1.5

Enter the bottom margin of the paper:

1

Enter the point size of the paper:

12

Enterline spacing,s or S (Single spaced),d or D (Double spaced):

s

The number of lines that can be printed : 48

The number of characters that can be printed in a line: 39
 
Paps last na po talaga😅🙏
https://www.Çℎḙḡḡ.com/homework-help...s-finds-prints-sum-even-odd-integers-q2492789

https://www.Çℎḙḡḡ.com/homework-help...ints-nth-value-fibonacci-sequence-m-q24363440
 
[XX='Renzo_Tino, c: 560661, m: 1796307'][/XX]
import java.util.Scanner;

public class Printing {

public static void main(String[] args) {

// Constants

final int ONE_INCH = 72;

final char DOUBLE_LOWER = 'd';

final char DOUBLE_UPPER = 'D';

final char SINGLE_LOWER = 's';

final char SINGLE_UPPER = 'S';

// input fields accept from user

char space = 0;

double length = 0;

double width = 0;

double leftMargin = 0;

double rightMargin = 0;

double topMargin = 0;

double bottomMargin = 0;

double pointSize = 0;

int totalCharacters = 0;

int totalLines = 0;

int finalLength = 0;

double finalWidth = 0;

int pointsLength = 0;

double pointsWidth = 0;

Scanner sc = new Scanner(System.in);

System.out.println("Enter the length of the paper:");

length = sc.nextDouble();

System.out.println("Enter the width of the paper:");

width = sc.nextDouble();

System.out.println("Enter the left margin of the paper:");

leftMargin = sc.nextDouble();

System.out.println("Enter the right margin of the paper:");

rightMargin = sc.nextDouble();

System.out.println("Enter the top margin of the paper:");

topMargin = sc.nextDouble();

System.out.println("Enter the bottom margin of the paper:");

bottomMargin = sc.nextDouble();

System.out.println("Enter the point size of the paper:");

pointSize = sc.nextDouble();

System.out

.println("Enterline spacing,s or S (Single spaced),d or D (Double spaced):");

String lineSpace = sc.next();

space = lineSpace.charAt(0);

finalLength = (int) (length - (topMargin + bottomMargin));

finalWidth = width - (leftMargin + rightMargin);

pointsLength = finalLength * ONE_INCH;

pointsWidth = finalWidth * ONE_INCH;

if (space == DOUBLE_UPPER || space == DOUBLE_LOWER) {

pointSize += pointSize;

totalLines = (int) (pointsLength / pointSize);

totalCharacters = (int) (pointsWidth / pointSize);

System.out.println("The number of lines that can be printed : "

+ totalLines);

System.out

.println("The number of characters that can be printed in a line: "

+ totalCharacters);

} else if (space == SINGLE_UPPER || space == SINGLE_LOWER) {

totalLines = (int) (pointsLength / pointSize);

totalCharacters = (int) (pointsWidth / pointSize);

System.out.println("The number of lines that can be printed : "

+ totalLines);

System.out

.println("The number of characters that can be printed in a line: "

+ totalCharacters);

}

sc.close();

}

}

Output:

Enter the length of the paper:

11

Enter the width of the paper:

8.5

Enter the left margin of the paper:

1

Enter the right margin of the paper:

1

Enter the top margin of the paper:

1.5

Enter the bottom margin of the paper:

1

Enter the point size of the paper:

12

Enterline spacing,s or S (Single spaced),d or D (Double spaced):

s

The number of lines that can be printed : 48

The number of characters that can be printed in a line: 39
 
Status
Not open for further replies.

About this Thread

  • 12
    Replies
  • 348
    Views
  • 4
    Participants
Last reply from:
phdonasarmy

Trending Topics

Online now

Members online
1,177
Guests online
4,903
Total visitors
6,080

Forum statistics

Threads
2,313,225
Posts
29,172,488
Members
1,184,645
Latest member
rute0230
Back
Top