Topics Methods Method Definition Method Header Method Body Method Call Descripti
ID: 3567299 • Letter: T
Question
Topics Methods Method Definition Method Header Method Body Method Call Description Write a program that will ask the user to provide his/her personal information such as name. address etc. Then it will display the information in a particular form. The program will ask the user to input the following: . The user?s full name. . The user?s street address. . The user?s city and state address The program will display the user information over five lines as described below: First Line (Header Line): The program will display the character ?*? 30 times making tip the header line. Second Line: The program will display the user? s Full Name. Third Line: The program will display the user? s Street Address. Fourth Line: The program will display the user?s City and State Address. Fifth Line (Footer Line): The program will display the character ?* 30 times making tip the footer line. Instructions Write the program using the following two methods: The method main The method display Method display () Write a static method named display. This method will return no value (i.e. will have void as the return type) and will receive no parameters. When called, the method display will display a line of 30 ?C characters. The method will use a For loop for display; mg the characters In each pass through the loop it will display one * charter using the method S stem out print After finishing the loop it will output the ne; line n characterExplanation / Answer
#include<iostream>
using namespace std;
void display(){
for(int i=0; i<30 ;i++){
cout << "*";
}
cout << endl;
}
int main(){
string name, address, cityAddress;
cout << "Enter Your Full Name: ";
getline(cin, name);
cout << "Enter Your Street Address: ";
getline(cin,address);
cout << "Enter Your Coty and State Address: ";
getline(cin,cityAddress);
display();
cout << name << endl;
cout << address << endl;
cout << cityAddress << endl;
display();
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.