Program 1: Write a program which does the following: Takes 2 int data type inputs from the user, say in ​num1​ and ​num2​. And print ​true​ if any one of the numbers is equal to 100 or their sum is equal to 99. Else print ​false​. But there is a restriction: This logic for point# 2 above should be done inside the println() statement. So everything should be done inside this: System.​out.​ println(... write logic here...)​; ​//hint: use logical operators     Program 2: Write a program which does the following: Takes 2 int data type inputs from the user, say in ​num1​ and ​num2​. And print ​true​ if both the numbers are between 11 and 99 (inclusive), or if both the numbers are between 99 and 199 (inclusive). Else print ​false​. But there is a restriction: This logic for point# 2 above should be done inside the println() statement. So everything should be done inside this: System.​out.​ println(... write logic here...)​; ​//hint: use logical operators

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question

Program 1:

Write a program which does the following:

  1. Takes 2 int data type inputs from the user, say in ​num1​ and ​num2​.

  2. And print ​true​ if any one of the numbers is equal to 100 or their sum is equal to 99. Else

    print ​false​.

  3. But there is a restriction:

    This logic for point# 2 above should be done inside the println() statement. So everything should be done inside this:
    System.​out.​ println(... write logic here...)​; ​//hint: use logical operators

 

 

Program 2:

Write a program which does the following:

  1. Takes 2 int data type inputs from the user, say in ​num1​ and ​num2​.

  2. And print ​true​ if both the numbers are between 11 and 99 (inclusive), or if both the numbers

    are between 99 and 199 (inclusive). Else print ​false​.

  3. But there is a restriction:

    This logic for point# 2 above should be done inside the println() statement. So everything should be done inside this:
    System.​out.​ println(... write logic here...)​; ​//hint: use logical operators

 

 

Program 3:

1. Create a String constant ‘SPACE’, which holds a space ( “ “ ).

final ​String SPACE = ​" "​; /*‘final’ keyword creates a constant in Java. Once a ‘final’ variable is initialized, it values cannot be changed*/
2. Get the name of your ( or a fictional ) pet and save it to a String variable.

3. Get the age of your (or a fictional ) pet and save it to an int variable.
4. Print out the name and age of your pet, use your constant in the println wherever space character is needed.

Sample output:

Enter name : yoyo

Enter age: 3

My pet's name: Yoyo

My pet's age : 3

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr