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
I am Lyosha
1 month 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:
amid [800]1 month ago
7 0

Answer:

The following changes will be implemented to the source code

const int YEAR = 2050;

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

Explanation:

First, YEAR needs to be defined as a constant integer. This is represented as follows;

const int YEAR = 2050;

This allows us to refer to YEAR throughout the program

Next,

Substitute the following:

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

with

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

The revised source file is attached;

Download cpp
You might be interested in
You work in the educational software industry. Your boss asks you to give a brief lecture to other employees about the digital d
Harlamova29_29 [932]
Joe mama is the most extraordinary person on the planet.
5 0
24 days ago
Read 2 more answers
Sushant is a new manager and he wants to share his ideas and working protocol with his team.Compare the advantages and disadvant
oksian1 [797]

Answer:

Benefits of Oral Communication

  1. Utilizing visual aids such as PowerPoint during discussions can enhance his team's understanding of his concepts and procedures.
  2. Staff responses tend to be more immediate and sincere compared to written replies.

Drawbacks of Oral Communication

  1. If Sushant struggles with stage fright or lacks strong communication skills, it may negatively impact the team's perception of him.
  2. There is a risk that staff may forget portions of Sushant's spoken communication, as written information is generally more reliable for retention.

Benefits of Written Communication

  1. A well-crafted memo articulates Sushant's ideas and procedures clearly to the staff.
  2. A feedback questionnaire could be included for staff input.
  3. Clearly stated goals and objectives.

Drawbacks of Written Communication

  1. Excessively lengthy written material may pose challenges for comprehension or retention.

It is advisable for Sushant to prioritize written communication to share his ideas and protocols effectively.

3 0
1 month ago
Which kind of file would be hurt most by lossy compression algorithm
oksian1 [797]

Response: a file containing audio

Clarification:

8 0
10 days ago
Read 2 more answers
Assume a machine during its initial testing phase produces 10 widgets a day. After 10 days of testing (starting on day 11), it b
Harlamova29_29 [932]

Response:

Python Code:

n = int(input("Days: "))

total = 0

for i in range(1,n+1):

     if i <= 10:

           total += 10

     elif i <= 60:

           total += 40

     elif i <= 99:

           total += 100 - i

print(str(total)+ " widgets")

Clarification:

This line requests user input for the number of days.

n = int(input("Days: "))

This line sets the initial total number of widgets to zero.

total = 0

The subsequent loop calculates total widgets based on the established rules.

for i in range(1,n+1):

     if i <= 10: -> Applies when days are 10 or fewer

           total += 10

     elif i <= 60: -> Applies when days are between 11 and 60

           total += 40

     elif i <= 99: -> Applies when days are under 100

           total += 100 - i

This line outputs the total count.

print(str(total)+ " widgets")

4 0
28 days ago
A method countDigits(int num) of class Digits returns the remainder when the input argument num(num &gt; 0) is divided by the nu
ivann1987 [930]

Answer:

#include <iostream>

using namespace std;

class Digits

{

   public:

   int num;

   int read()       //method to read num from user

   {

       cout<<"Enter number(>0)\n";

       cin>>num;

       return num;

   }

   int digit_count(int num)  //method to count number of digits of num

   {

       int count=0;

       while(num>0)    //loop till num>0

       {

           num/=10;

           count++;   //counter which counts number of digits

       }

       return count;

   }

   int countDigits(int num)   //method to return remainder

   {

       int c=digit_count(num); //calls method inside method

       return num%c;  

   }

};

int main()

{

   Digits d;    //object of class Digits is created

   int number=d.read();   //num is read from user

   cout<<"\nRemainder is: "<<d.countDigits(number);  //used to find remainder

   return 0;

}

Output:

Enter number(>0)

343

Remainder is: 1

Explanation:

The program has a logical error that needs rectification. A correctly structured program calculates the remainder when a number is divided by the count of its digits. A class named Digits is created, consisting of the public variable 'num' and methods for reading input, counting digits, and calculating the remainder.

  • read() - This function asks the user to enter the value for 'num' and returns it.
  • digit_count() - This function accepts an integer and counts how many digits it has, incrementing a counter until 'num' is less than or equal to 0. It ultimately returns the digit count.
  • countDigits() - This function takes an integer and delivers the remainder from dividing that number by its digit count. The digit count is computed using the 'digit_count()' method.

Finally, in the main function, a Digits object is instantiated, and its methods are utilized to produce an output.

7 0
1 month ago
Other questions:
  • Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
    12·1 answer
  • Sarah works in a coffee house where she is responsible for keying in customer orders. A customer orders snacks and coffee, but l
    13·2 answers
  • Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input.
    6·1 answer
  • A company decides to relocate its operations to another state in order to take advantage of some new business investment credits
    15·1 answer
  • Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name
    10·1 answer
  • Consider a one-way authentication technique based on asymmetric encryption: A --&gt; B: IDA B --&gt; A: R1 A --&gt; B: E(PRa, R1
    13·1 answer
  • 3. What is the error in the following pseudocode? // The searchName function accepts a string containing the name // to search f
    6·1 answer
  • Write a loop to populate the list user_guesses with a number of guesses. The variable num_guesses is the number of guesses the u
    13·1 answer
  • When adopting and implementing a Software as a Service (SaaS) platform such as Salesforce for your business, which responsibilit
    7·1 answer
  • Describe a situation involving making a copy of a computer program or an entertainment file of some sort for which you think it
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!