167k views
1 vote
For all Programs:To get in the habit of writing pseudocode write the simple pseudocode for these programs. The pseudocode for #1 for example can be as simple as "Display Student Information on Screen formatted on 4 Lines". Put your pseudocode in comments at the top of your programs, as well as many lines within the code necessary to describe what’s going on in the program. PSEUDOCODE IS REQUIRED FOR ALL PROGRAMS.For each program make sure and include the following comments at the top (do this on all homework assignments from now on – this is required)://Your Name //CS 52, Section 1766 //Assignment #X, Problem #Y //Summary of the programFor this first homework you have five SHORT programs, so you will be submitting 5 source files via Canvas. Future homework assignments will not have this many programs involved; these are simple programs. That is the only reason there are so many programs for this assignment. These programs address the basics from Chapters 1 – 4.Student Information Program1. Write a program that displays the following information about yourself: your name, the computer languages you know (you can write "none"), your favorite video game, and what 3 people/characters, real or imaginary, living or dead, . You should format your program output similar to the output below (make sure and use your own name and information):

1 Answer

2 votes

Question is not complete.

The question only points to 1 program out of 5.

I'll write the program and write additional 4 programs to makeup for the missing part of the question.

All 5 programs will be written using C++ programming language.

The pseudocode will be written as comments

I'll make the following assumptions

1. Student name: Albert Newton

2. Course: Computer Programming

Answer:

Program 1:

Write a program that displays the following information about yourself: your name, the computer languages you know (you can write "none"), your favorite video game, and what 3 people/characters, real or imaginary, living or dead.

// Albert Newton

// Computer Programming

// Assignment 1

// Pseudocode starts here

/*

Start:

Display "Student Name: Albert Newton"

Display "Programming Languages: C++, Java and Python Programming Languages"

Display "Fvourite video game: Mortal Kombat"

Display "People/Characters: Superman, Captain America and Batman"

Stop

*/

// Program starts here

using namespace std;

int main()

{

cout<< "Student Name: Albert Newton";

cout<< "Programming Languages: C++, Java and Python Programming Languages";

cout<< "Fvourite video game: Mortal Kombat";

cout<< "People/Characters: Superman, Captain America and Batman";

return 0;

}

// End of Program 1

Program 2: Program to check if a number is an even number or an odd number

// Albert Newton

// Computer Programming

// Assignment 1

// Pseudocode starts here

/*

Start:

Input Number

If(Number % 2 == 0)

Display "Even Number"

Else

Display "Odd Number"

Endif

Stop

*/

// Program starts here

# include<iostream>

using namespace std;

int main()

{

// Declare and Input Number

int Number;

cin>> Number;

// Test for even or odd

if(Number%2 == 0)

cout<<"Even Number";

else

cout<<"Odd Number";

return 0;

}

Program 3: Program to print the perimeter of a rectangular shape

// Albert Newton

// Computer Programming

// Assignment 1

// Pseudocode starts here

/*

Start:

Input Length, Breadth

Perimeter = 2(Length + Breadth)

Display Perimeter

Stop

*/

// Program starts here

#include<iostream>

using namespace std;

int main ()

{

// Declare all Variables

double length, breadth, perimeter;

// Input Length and Breadth

cin>>length;

cin>>breadth;

// Calculate and Print Perimeter

perimeter = 2 * (length + breadth);

cout<<perimeter;

return 0;

}

Program 4: Program to check for palindrome numbers

// Albert Newton

// Computer Programming

// Assignment 1

// Pseudocode starts here

/*

Start:

Input number

Sum = 0

Temp = number

Do

Remainder = number % 10

Sum = (Sum * 10) + Remainder

While Number > 0

If Sum == Temp

Display " Palindrome"

Else

Display " Not Palindrome"

End if

Stoo;

*/

//Program starts here

#include <iostream>

using namespace std;

int main()

{

int n,r,sum=0,temp;

cout<<"Enter the Number=";

cin>>n;

temp=n;

while(n>0)

{

r=n%10;

sum=(sum*10)+r;

n=n/10;

}

if(temp==sum)

cout<<"Number is Palindrome.";

else

cout<<"Number is not Palindrome.";

return 0;

}

Program 5: Program to perform simple addition

// Albert Newton

// Computer Programming

// Assignment 1

// Pseudocode starts here

/*

Start:

Input Number1

Input Number2

Result = Number1 + Number2

Display Result

Stop.

*/

//Program starts here

#include<iostream>

using namespace std;

int main()

{

// Declare numbers

double num1, num2, result;

// Input numbers

cin>>num1;

cin>>num2;

// Add numbers

result = num1 + num2;

// Print result

cout<<result;

return 0;

}

User Dan Fox
by
5.5k points