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
KiRa [710]
3 years ago
9

Assume that two int constants,FIRST_YEAR and LAST_YEAR have already been declared and initialized with year values (like 2009, 2

014), along with a double variable oil that has been initialized with the number of barrels of oil consumed in Canada in the year given by FIRST_YEAR. Write some code that uses a while statement to print on a line by itself, each of the years from FIRST_YEAR to LAST_YEAR inclusive. On each line, after the year, separated by a colon and a space, print the new value amount of oil, taking into account that each year the oil consumed increases by 20%.
Computers and Technology
1 answer:
Kitty [74]3 years ago
5 0

// While loop

while(FIRST_YEAR < LAST_YEAR)

{

cour<<"Year : " << First_YEAR << " Oil consumed is : " << oil <<"."<<endl;

FIRST_YEAR+=1;

// calculate the 20% increase

oil = oil + (oil *.20)

}

You might be interested in
Write a Comparator that compares String objects by the number of words they contain. Consider any nonwhitespace string of charac
Readme [11.4K]

Answer:

import java.util.Scanner;

public class num12 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter the first String");

       String word1 = in.nextLine();

       System.out.println("Enter the second String");

       String word2 = in.nextLine();

       System.out.println("Enter the third String");

       String word3 = in.nextLine();

       //Remove all white spaces

        String cword1 = word1.replace(" ","");

       String cword2 = word2.replace(" ","");

       String cword3 = word3.replace(" ","");

       //Comparing the string by their lengths

       if(cword1.length()>cword2.length()&&cword1.length()>cword3.length()){

           System.out.println(word1+" Is the longest");

       }

       else if(cword2.length()>cword1.length()&&cword2.length()>cword3.length()){

           System.out.println(word2+" Is the longest");

       }

       else{

           System.out.println(cword3+" Is the longest");

       }

   }

}

Explanation:

Using Java Programming Language

Use the Scanner Class to obtain the String values from the user

Save them in different variables

Use the replace() method in java to remove white space from any of the string entered

Using if and else statements compare the lengths of the strings (word.length()) returns the length of the word.

Print out the word that is longest

NOTE I have compared three Strings, comparing two would have been more straigth forward

8 0
4 years ago
If you create a column break, what happens to the text after the insertion point?
Ugo [173]

Answer:

It moves to the top of the next column.

5 0
3 years ago
Two key components of corporate profitability are _________ and _________.
Maru [420]
I would say that the key components of corporate profitability are firstly to have a solid structure and system which allows the company to be efficient, productive and predictable. the second component should be financial literacy which means that the owner or boss must be aware of the financial situation of the company in order to make good decisions for the business. 
7 0
3 years ago
Shared content can be categorized into two main categories: curated, which is content gathered from trusted sources relevant to
Kipish [7]

Answer:

Created is the correct answer of the following question.

Explanation:

Communal content can be classified into two key categories: curated content obtained from reputable sources related to your industry, and generated content developed within your company that includes things such as blog posts, white papers, infographics, guides and visuals.

Create is about trying something new. These are among the most commonly mentioned articles relating to the development of files, records, and other artifacts on a device.

5 0
3 years ago
If a user has one column in a table and would like to make it into two columns, which command should be used?
8090 [49]

Answer:

Split Cells

Explanation:

7 0
3 years ago
Other questions:
  • While working on a group project, you notice something does not look right in the presentation. You call a meeting with your tea
    9·1 answer
  • The internet is a worldwide assembly of computer
    11·1 answer
  • Select the correct answer from each drop-down menu.
    10·1 answer
  • Using the drop-down menus, correctly complete the sentences.
    5·2 answers
  • A personal career profile for can be used to match what you know about yourself to what you know about different careers
    7·2 answers
  • Run a Monte Carlo simulation on this vector representing the countries of the 8 runners in this race:
    7·1 answer
  • Given a matrix input_matrix, return a Numpy array that consists of every entry of A that has: an even row index in the range [0,
    9·1 answer
  • What G-Suite Apps integrate with Forms
    14·2 answers
  • What precautions should be taken to make a computer more secure ​
    8·1 answer
  • Which characters are used in hump notion?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!