Question

In: Computer Science

Write program logic or pseudocode to create 3 small programs that do the following: The first...

Write program logic or pseudocode to create 3 small programs that do the following:

  • The first should compute the sum of 2 given integers.
  • The second should multiply the 2 integers.
  • The third should triple the sum of the 2 integers.

Solutions

Expert Solution

program in c++

#include<iostream>
using namespace std;
//method to add two integers
int first(int a,int b)
{
    return a+b;
}
//method to multiply two integers
int prod(int a, int b)
{
   return a*b;
}
  
//method to triple the sum of two integers
int triple(int a, int b)
{
    return 3*(a+b);
}
//driver program
int main()
{
   int a,b,c;
   cout<<"\n Enter two integers";
   cin>>a>>b;//input two integers
   cout<<endl<<a<<" + "<<b<<" = "<<first(a,b);//print the sum of a and b
       cout<<endl<<a<<" * "<<b<<" = "<<prod(a,b);//multiply a and b
       cout<<endl<<"The triple of sum of "<<a<<" and "<<b<<" is "<<triple(a,b)   ;//triple the sum of a and b
   }

outpur


Related Solutions

write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
Write a Python program that: Create the algorithm in both flowchart and pseudocode forms for the...
Write a Python program that: Create the algorithm in both flowchart and pseudocode forms for the following requirements: Reads in a series of positive integers,  one number at a time;  and Calculate the product (multiplication) of all the integers less than 25,  and Calculate the sum (addition) of all the integers greater than or equal to 25. Use 0 as a sentinel value, which stops the input loop. [ If the input is 0 that means the end of the input list. ]...
1. Write pseudocode for the following program. You do not have to write actual C++ code....
1. Write pseudocode for the following program. You do not have to write actual C++ code. Assume you have a text file, that has been encrypted by adding 10 to the ASCII value of each character in the message. Design a decryption program that would reverse this process, and display the original message to the console.to the new array. 2.Write the code for the specified program. Use proper style and naming. Test and upload your code as a CPP file....
(C++)Write a small program that implements the "fan tester" logic To recall: Logic in electronic devices....
(C++)Write a small program that implements the "fan tester" logic To recall: Logic in electronic devices. Most of the devices and appliances used in everyday life are controlled by electronic circuitry that works according to the laws of logic. A designer of an electronically-controlled device must first express the desired behavior in logic, and then test that the device behaves as desired under every set of circumstances. An electronic fan automatically turns on and off depending on the humidity in...
a.Create the logic for a program using pseudocode that calculates and displays the amount of money...
a.Create the logic for a program using pseudocode that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed. b.Modify the program in Exercise 2a so that the main program prompts the user for the amount of money and passes it to the interest-calculating method. c.Modify the program in Exercise 2b so that...
Choose one of the three following programs to do as your first program. You need to...
Choose one of the three following programs to do as your first program. You need to turn in a flowchart and program documentation with the .cpp program (this can be done within the program) and a copy of your output. The Program I chose is : #19. Monthly Payments The monthly payment on a loan may be calculated by the following formula: Payment= Rate × (1+Rate)N (1+Rate)N−1×L Rate is the monthly interest rate, which is the annual interest rate divided...
create flowchart using Flowgorithm and Pseudocode for the following program example:   Design a program for Jones...
create flowchart using Flowgorithm and Pseudocode for the following program example:   Design a program for Jones College. The current tuition is $12,000 per year, and tuition is expected to increase by 5 percent each year. Display the tuition amount for each year over the next five years (use a looping structure).
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score...
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score and letter grade for one student. Please use the following grading system: 9 Homework Assignments – 100 points each 10 points 11 Quizzes – 100 points each 5 points 5 Projects – 100 points each 10 points 6 Discussion posts – 100 points each 10 points 4 Exams – 100 points each 65 points A = 90 – 100% B = 80 – 89%...
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score...
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score and letter grade for one student. Please use the following grading system: 9 Homework Assignments – 100 points each 10 points 11 Quizzes – 100 points each 5 points 5 Projects – 100 points each 10 points 6 Discussion posts – 100 points each 10 points 4 Exams – 100 points each 65 points A = 90 – 100% B = 80 – 89%...
Does anyone know how to do pseudocode on this topic? Write a program to perform the...
Does anyone know how to do pseudocode on this topic? Write a program to perform the following two tasks: 1. The program will accept a string as input in which all of the words are run together, but the first character of each word is uppercase. Convert the string to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string "StopAndSmellTheRose" would be converted to "Stop...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT