answer.
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
klemol [59]
2 years ago
12

Declare a constant named YEAR, and initialize YEAR with the value 2050. Edit the statement myNewAge = myCurrentAge + (2050 − cur

rentYear) so it uses the constant named YEAR. Edit the statement cout << "I will be " << myNewAge << " in 2050." << endl; so it uses the constant named YEAR.#include
using namespace std;
int main()
{
int myCurrentAge = 29;
int myNewAge;
int currentYear = 2014;


myNewAge = myCurrentAge + (2050 - currentYear);

cout << "My Current Age is " << myCurrentAge << endl;
cout << "I will be " << myNewAge << " in 2050." << endl;

return 0;
}
looking for code pattern
Computers and Technology
1 answer:
givi [52]2 years ago
7 0

Answer:

The following edits will be made to the source code

const int YEAR = 2050;

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

Explanation:

First, YEAR has to be declared as an integer constant. This is shown as follows;

<em>const int YEAR = 2050;</em>

This will enable us make reference to YEAR in the program

Next,

Replace the following:

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

<em>with</em>

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

<em>I've added the edited source file as an attachment;</em>

Download cpp
You might be interested in
In three to five sentences, describe how you can organize written information logically and sequentially
gogolik [260]

I’d organize my writing by using the five paragraph method and set it up in a chronological order. I’d begin with an introduction. An introduction will make the reader understand the topic and what I am going to be talking about in the body paragraph. An introduction has the hook which draws the reader with good and interesting sentences. There is also the bridge and then there is the thesis statement that will explain my main points. Next is to write the body paragraph. This will explain the points in the intro in more depth so that the reader can better understand what is going on. Lastly there is the conclusion, which reviews will review my main point again and summarize all of my points.

5 0
2 years ago
A database should have an identity separate from the applications (computer programs, forms, and reports) that use it. The separ
eduard

The separate identity allows the database definition to be changed without affecting related applications is known as <u>DATA.</u>

<u>Explanation:</u>

Normally nowadays program and database are keeping separately. MySQL server, mongo dB, oracle, sql server extra installed separate followed folder or separate drive in operating system.

So software program just use connectivity technology to add or update or delete information from in the database. Form or report just access the data from database and produce required output.

Normal SQL database will stored as records as rows in tables. Normally database can been access through database application directly to update records such as SQL PLUS, MYSQL workbench etc.

6 0
2 years ago
Create the class named SortFile. The class will have a single attribute, which is an ArrayList of integers. The class will have
S_A_V [24]

Answer:

See explaination

Explanation:

//SortFile.java

import java.io.File;

import java.io.FileNotFoundException;

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

public class SortFile {

// array list of integers to store the numbers

private ArrayList<Integer> list;

// default constructor

public SortFile() {

// initializing list

list = new ArrayList<Integer>();

// reading file name using a scanner

Scanner sc = new Scanner(System.in);

System.out.print("Enter file name: ");

String filename = sc.nextLine();

// opening file inside a try catch block. if you want to throw exception

// instead, just remove try-catch block and add throws

// FileNotFoundException to the method signature.

try {

// opening file

sc = new Scanner(new File(filename));

// looping and reading each integer from file to list

while (sc.hasNextInt()) {

list.add(sc.nextInt());

}

// closing file

sc.close();

} catch (FileNotFoundException e) {

// exception occurred.

System.err.println(e);

}

}

// constructor taking a file name

public SortFile(String filename) {

// initializing list

list = new ArrayList<Integer>();

// opening file inside a try catch block. if you want to throw exception

// instead, just remove try-catch block and add throws

// FileNotFoundException to the method signature.

try {

Scanner sc = new Scanner(new File(filename));

// looping and reading each integer from file to list

while (sc.hasNextInt()) {

list.add(sc.nextInt());

}

sc.close();

} catch (FileNotFoundException e) {

System.err.println(e);

}

}

// method to return a sorted array of integers containing unique elements

// from list

public int[] sort() {

// creating an array of list.size() size

int arr[] = new int[list.size()];

// count of unique (non duplicate) numbers

int count = 0;

// looping through the list

for (int i = 0; i < list.size(); i++) {

// fetching element

int element = list.get(i);

// if this element does not appear before on list, adding to arr at

// index=count and incrementing count

if (!list.subList(0, i).contains(element)) {

arr[count++] = element;

}

}

// now reducing the size of arr to count, so that there are no blank

// locations

arr = Arrays.copyOf(arr, count);

// using selection sort algorithm to sort the array

int index = 0;

// loops until index is equal to the array length. i.e the whole array

// is sorted

while (index < arr.length) {

// finding the index of biggest element in unsorted array

// initially assuming index as the index of biggest element

int index_max = index;

// looping through the unsorted part of array

for (int i = index + 1; i < arr.length; i++) {

// if current element is bigger than element at index_max,

// updating index_max

if (arr[i] > arr[index_max]) {

index_max = i;

}

}

// now we simply swap elements at index_max and index

int temp = arr[index_max];

arr[index_max] = arr[index];

arr[index] = temp;

// updating index

index++;

// now elements from 0 to index-1 are sorted. this will continue

// until whole array is sorted

}

//returning sorted array

return arr;

}

//code for test-run

public static void main(String[] args) {

//initializing SortFile using default constructor

SortFile sortFile = new SortFile();

//displaying sorted array

System.out.println(Arrays.toString(sortFile.sort()));

}

6 0
2 years ago
Assume the array of integers values has been created. Which condition must be used in the indicated area so the loop below will
scZoUnD [109]

Answer:

val > max

Explanation:

Assuming the values array is already created, inside the loop, we need to check if the val, a value in the values array, is greater than max. If it is greater than the max, that means it is our new max. Then we would set the max as the val. This way, if there is any value greater than max, it will be our max at the end of the loop.

7 0
2 years ago
In a well-designed detail report, a field called a(n) ____ field controls the output.
Illusion [34]

Answer:

Control

Explanation:

5 0
2 years ago
Other questions:
  • The Internet is BEST described as a vast _______ connection of computer networks that also link to smaller networks
    9·1 answer
  • Rupa would like to quickly insert a table into her document without having to worry about formatting the data in the table. Whic
    5·2 answers
  • Read this excerpt from The Outsiders. Or I could have gotten one of the gang to come along, one of the four boys Darry and Soda
    6·2 answers
  • Lai worked on a global team for an American company, and all her work had to be completed in her second language, English. Somet
    9·2 answers
  • Static packet filtering firewalls are limited to ________. inspecting packets for which there are good application proxy filteri
    8·1 answer
  • For the (pseudo) assembly code below, replace X, Y, P, and Q with the smallest set of instructions to save/restore values on the
    10·1 answer
  • Write a loop that prints each country's population in country_pop. Sample output for the given program.
    6·1 answer
  • Doctors discovered a tumor in Amanda’s brain and used robotic surgery to remove it. Which best describes the role a worker in th
    15·2 answers
  • Zoom Vacuum, a family-owned manufacturer of high-end vacuums, has grown exponentially over the last few years. However, the comp
    11·1 answer
  • In Python, parentheses are used in calculations where the order of operations affects the outcome. (5 points)
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!