1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ray Of Light [21]
2 years ago
12

Create a basic program that accomplishes the following requirements: Allows the user to input 2 number , a starting number x and

ending number y Implements a while loop that counts from x (start) to y(end). Inside the loop , print to the screen rather the current number is even or odd If the number is even , multiply by the number by 3 and print the results to the screen. If the number is odd , add 10 and print the results to the screen. Use at least 1 increment or decrement operator.
Computers and Technology
1 answer:
katrin [286]2 years ago
6 0

Answer:

Explanation:

The following program is written in Java. It asks the user for the two inputs and then uses those inputs in a for loop. The loop goes through each number checking to see if it is even or odd. If it is even it prints out Even: and the number after multiplying it by 3. If it is odd it prints out Odd: and the number after adding 10 to it. The output can be seen in the attached picture below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter number 1: ");

       int num1 = in.nextInt();

       System.out.println("Enter number 2:");

       int num2 = in.nextInt();

       for (int x = num1; x <= num2; x++) {

           if ((x % 2) == 0) {

               System.out.println("Even: " + (x*3));

           } else {

               System.out.println("Odd: " + (x+10));

           }

       }

   }  

}

You might be interested in
Which of the following statements expresses why the following code is considered bad form? for (rate = 5; years-- &gt; 0; System
OlgaM077 [116]

Answer:

l and ll only that is the answer

7 0
3 years ago
Read 2 more answers
What will be displayed after code corresponding to the following pseudocode is run? Main Set OldPrice = 100 Set SalePrice = 70 C
Tatiana [17]

Answer:

A jacket that originally costs $ 100 is on sale today for $ 80                                    

Explanation:

Main : From here the execution of the program begins

Set OldPrice = 100  -> This line assigns 100 to the OldPrice variable

Set SalePrice = 70   -> This line assigns 70to the SalePrice variable

Call BigSale(OldPrice, SalePrice)  -> This line calls BigSale method by passing OldPrice and SalePrice to that method

Write "A jacket that originally costs $ ", OldPrice  -> This line prints/displays the line: "A jacket that originally costs $ " with the resultant value in OldPrice variable that is 100

Write "is on sale today for $ ", SalePrice  -> This line prints/displays the line: "is on sale today for $ " with the resultant value in SalePrice variable that is 80

End Program -> the main program ends

Subprogram BigSale(Cost, Sale As Ref)  -> this is a definition of BigSale method which has two parameters i.e. Cost and Sale. Note that the Sale is declared as reference type

Set Sale = Cost * .80  -> This line multiplies the value of Cost with 0.80 and assigns the result to Sale variable

Set Cost = Cost + 20  -> This line adds 20 to the value of Cost  and assigns the result to Cost variable

End Subprogram  -> the method ends

This is the example of call by reference. So when the method BigSale is called in Main by reference by passing argument SalePrice to it, then this call copies the reference of SalePrice argument into formal parameter Sale. Inside BigSale method the reference &Sale is used to access actual argument i.e. SalePrice which is used in BigSale(OldPrice, SalePrice) call. So any changes made to value of Sale will affect the value of SalePrice

So when the method BigSale is called two arguments are passed to it OldPrice argument and SalePrice is passed by reference.

The value of OldPrice is 100 and SalePrice is 70

Now when method BigSale is called, the reference &Sale is used to access actual argument SalePrice = 70

In the body of this method there are two statements:

Sale = Cost * .80;

Cost = Cost + 20;

So when these statement execute:

Sale = 100 * 0.80 = 80

Cost = 100 + 20 = 120

Any changes made to value of Sale will affect the value of SalePrice as it is passed by reference. So when the Write "A jacket that originally costs $ " + OldPrice Write "is on sale today for $ " + SalePrice statement executes, the value of OldPrice remains 100 same as it does not affect this passed argument, but SalePrice was passed by reference so the changes made to &Sale by statement in method BigSale i.e.  Sale = Cost * .80; has changed the value of SalePrice from 70 to 80 because Sale = 100 * 0.80 = 80. So the output produced is:

A jacket that originally costs $ 100 is on sale today for $ 80                              

7 0
3 years ago
The file type blank identifies a word 2013 document
ZanzabumX [31]
Hey there! Hello!

The exclusive file type for Microsoft Word documents is .docx. You can see the attachment showing all the information you need to know about the example Word document I created. As long as you are using Word, the file type will be the same no matter what type of computer you're on or what it's running, so you don't need to worry about it being different for me on Mac than it might be for you on Windows. 

Hope this helped you out! Feel free to ask me any additional questions you may have. :-)

4 0
3 years ago
Um i'm new here... and i don't know really how to use this... i was wondering if som 1 can help me
blagie [28]

Shining and warm

Collapse 3

JOJO

fate series

Bungou Stray Dog

EVA

Dao Master

Alien invasion

Future diary

Fate of Space

Story Series

Beyond the Boundary

Bayonetta

Onmyoji

Full-time master

How to develop a passerby heroine

Illusion Front

Psychometer

your name

Noragami

One Piece

Senran Kagura

Attacking Giant

Kabaneri of the Iron Fortress

Violet Evergarden

Demon Slayer

Under one person

Guilt crown

Black reef

Star Cowboy

Black Street Duo

Aria the Scarlet Ammo

Hatsune Miku

The last summoner

re creator

Detective Conan

Naruto

grim Reaper

Tokyo Ghoul

Song of Hell

At the beginning

Sword Art Online

Girl opera

Hakata pork bones pulled dough

Sunny

Black bullet

Trembling

On the broken projectile

Black Butler

Destiny's Gate

Persona

God Prison Tower

April is your lie

Ground-bound boy Hanako-kun

League of legends

Clever girl will not get hurt

Tomorrow's Ark

DARLING in the FRANKXX

RWBY

Little Busters

dating competition

Gintama

One Punch Man

The promised neverland

Taboo curse

God of college

Queen of Arms

Sword Net 3

Final fantasy

6 0
3 years ago
Read 2 more answers
Students with "Red" hair had the highest average number of free throws made on the "Hair Color Summary" table and students with
erik [133]
Babe he is is dis d did d did. D
4 0
3 years ago
Other questions:
  • Ushahidi is a crisis-mapping tool that makes information instantly available to anyone in the world. T/F
    10·1 answer
  • How would you delete a slide from your presentation after selecting it?
    12·1 answer
  • WILL GIVE BRAINLIEST TO FIRST AND BEST ANSWER!
    10·1 answer
  • All linear programming problems have all of the following properties EXCEPT
    9·2 answers
  • #include #include int main( ) { int value = 10; int pid; value += 5; pid = fork( ); if (pid &gt; 0 ) { value += 20; } printf(val
    10·1 answer
  • Please code this in c++
    10·1 answer
  • What is the most efficient way to prevent the spelling checker from repeatedly flagging a correctly spelled name in all of your
    5·1 answer
  • How do i delete an account for brainly how do i delete everything
    7·2 answers
  • The function below takes two arguments: a string (name) and an integer (position). Complete the function so that it prints out t
    7·1 answer
  • What is connectivity?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!