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
Nadusha1986 [10]
3 years ago
13

In this lab, you declare and initialize variables in a C++ program. The program, which is saved in a file named NewAge.cpp, calc

ulates your age in the year 2050.​
Computers and Technology
1 answer:
Ne4ueva [31]3 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int main() {

int currentYear = 2020;

int myCurrentAge = 23;

int myNewAge=myCurrentAge+(2050-currentYear);

cout << "My Current Age is " << myCurrentAge << endl;

cout << "I will be " << myNewAge << " in 2050." << endl;

}

Explanation:

  • Initialize the currentYear with 2020 and myCurrentAge with 23.
  • Add myCurrentAge with the the result of (2015 - currentYear) and assign this result to myNewAge variable.
  • Finally display my current age and after that display the new age in 2050.

Output:

My Current Age is 23

I will be 53 in 2050.

You might be interested in
A coffee shop is considering accepting orders and payments through their phone app and have decided to use public key encryption
arlik [135]
Somewhat they store the credit info
8 0
2 years ago
Create an application containing an array that stores 10 integers. The application should call five methods that in turn (1) dis
tensa zangetsu [6.8K]

Answer:

  1.     public class Main {
  2.    public static void main(String[] args) {
  3.        int myArray[] = {3, 7, 2, 5, 9,11, 24, 6, 10, 12};
  4.        int myArray2 [] = {1, 2, 3, 4 ,5};
  5.        displayValue(myArray);
  6.        reverseDisplay(myArray);
  7.        displaySum(myArray);
  8.        displayLess(myArray, 10);
  9.        displayHighAvg(myArray);
  10.        displayBoth(myArray, myArray2);
  11.    }
  12.    public static void displayValue(int arr[]){
  13.        for(int i = 0; i < arr.length; i++){
  14.            System.out.print(arr[i] + " ");
  15.        }
  16.        System.out.println();
  17.    }
  18.    public static void reverseDisplay(int arr[]){
  19.        for(int i = arr.length-1; i >= 0; i--){
  20.            System.out.print(arr[i] + " ");
  21.        }
  22.        System.out.println();
  23.    }
  24.    public static void displaySum(int arr[]){
  25.        int sum = 0;
  26.        for(int i = 0; i < arr.length; i++){
  27.            sum += arr[i];
  28.        }
  29.        System.out.println(sum);
  30.    }
  31.    public static void displayLess(int arr[], int limit){
  32.        for(int i = 0; i < arr.length; i++){
  33.            if(arr[i] < limit){
  34.                System.out.print(arr[i] + " ");
  35.            }
  36.        }
  37.        System.out.println();
  38.    }
  39.    public static void displayHighAvg(int arr[]){
  40.        int sum = 0;
  41.        for(int i = 0; i < arr.length; i++){
  42.            sum += arr[i];
  43.        }
  44.        double avg = sum / arr.length;
  45.        for(int i = 0; i < arr.length; i++){
  46.            if(arr[i] > avg){
  47.                System.out.print(arr[i] + " ");
  48.            }
  49.        }
  50.        System.out.println();
  51.    }
  52.    public static void displayBoth(int arr1[], int arr2 []){
  53.        for(int i = 0; i < arr2.length; i++){
  54.            for(int j = 0; j < arr1.length; j++){
  55.                if(arr1[j] == arr2[i]){
  56.                    System.out.print(arr1[j] + " ");
  57.                }
  58.            }
  59.        }
  60.        System.out.println();
  61.    }
  62. }

Explanation:

There are five methods written to solve all the problems stated in the question.

Method 1 : displayValue    (Line 15 - 21)

This is the method that take one input array and use the print() method to display the all the elements in the array.

Method 2: reverseDisplay (Line 23 - 26)

This method will take one input array and print the value in the reverse order. We just need to start with the last index when running the for-loop to print the value.

Method 3: displaySum (Line 31 - 37)

This method will take one input array and use a for-loop to calculate the total of the values in the array.

Method 4: displayLess (Line 39 - 47)

This method will take one two inputs, a array and a limit. We use the limit as the condition to check if any value less than the limit, then the value will only be printed.

Method 5: displayHighAvg (Line 50 - 64)

This method will take one input array and calculate the average. The average will be used to check if any element in the array higher than it, then the value will only be printed.

Method 6: displayBoth  (Line 66 - 75)

This method will take two input arrays and compare both of them to find out if any value appears in both input arrays and print it out.

3 0
3 years ago
A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
Ilya [14]

Answer: Maintenance. This is the stage where software is updated and hardware issues are fixed if and when they occur. Retirement. In this final stage, hardware becomes unusable or no longer needed and it needs to be properly removed from the fleet

Explanation:

3 0
3 years ago
Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can_______ the appropriate
Masteriza [31]

Answer:

a. call

Explanation:

According to my research on function, I can say that based on the information provided within the question the program can call the appropriate function. A function is a piece of code that completes a single task when called upon. Calling is another way of just saying that your telling the function to run its code at that given moment.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

4 0
3 years ago
You are working as a Solutions Architect for a technology company which is in the process of migrating their applications to AWS
torisob [31]

Answer: Amazon DynamoDB

Explanation: Amazon DynamoDB(Database) is the database that works in quick speed of milliseconds at any area.It has the characteristics like built-in security section, manageable, restoration function, durable etc.These features helps in handling the request of numerous people on large scale everyday.

It can work in multiple region to and can have multiple master .Thus, the database demand mentioned in the question can be completed by using Amazon DynamoDB as it can fulfill the requires of the company.

6 0
4 years ago
Other questions:
  • REEEEEEE I STILL NEED MORE AESTHETIC USERNAMES TO GO OFF OF PWEASE HELP IMA HAVE A PANIC ATTACK!!!... next post ima do a vote :&
    13·1 answer
  • Which of the following software is unique to a Mac?
    15·2 answers
  • Write a method called makeStars. The method receives an int parameter that is guaranteed not to be negative. The method returns
    14·1 answer
  • Database software lets the user sort information alphabetically, chronologically, or numerically. Which is NOT a commonly used d
    7·1 answer
  • Hiding data within pictures, audio, or video files can be difficult to detect and find. What can be done to reduce this?
    9·1 answer
  • How to reset maintenance light on toyota camry?
    12·1 answer
  • Which of the following would not be considered a polymer?
    14·2 answers
  • What are the 6 major forms that Energy can be grouped into?
    10·1 answer
  • Which of the following are pointers?
    9·1 answer
  • A web site that contains large numbers of misspelled words and grammatical errors fails which of these general criteria?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!