Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 5, Problem 2RQ
The body of a while loop can consist of ____________.
a. a single statement
b. a block of statements within curly braces
c. either a or b
d. neither a nor b
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Please help!! I don't understand most of the code. Please leave comments as explanations on every line of the code.
def repeatChar(numRepeats, outputChar):'''output the outputChar numRepeats times'''for colNo in range(numRepeats):print(outputChar, end='')def Parrallelogram(side, char):for i in range(side):repeatChar(i+1, char)print()for i in range(side):repeatChar(i+1, ' ')repeatChar(side-i-1, char)print()def outlineParallelogram(side, char):for i in range(side):if (i < 1):repeatChar(1, char)elif(i == 1):repeatChar(2, char)else:repeatChar(1, char)repeatChar(i-1, ' ')repeatChar(1, char)print()for i in range(side-1):if (i == side-2):repeatChar(side-1, ' ')repeatChar(1, char)else:repeatChar(i+1, ' ')repeatChar(1, char)repeatChar(side-i-3, ' ')repeatChar(1, char)print()print('This program will show a parallelogram and its outline')number = int(input('How long do you want each side to be? '))character = input('Enter the character: ')Parrallelogram(number,…
I having troubles running this C linux program.
please use my code to fix any errors that need to be removed or added.If it needs sin() cos() tan() - Please adddisplayTriTab • Receive an integer called degrees that represents the number of degree for incrementation and return nothing. • Display the heading “--- TRIGONOMETRIC TABLE ---” center over the table •A blank line • Display the column headings as sown on the output. • A blank line. • Produce a table based from 0 to 360 degrees in increments based on the users input. • The table columns will be as follows: 1. Degrees ( Format: Right justified, no decimal places) 2. The radian value for the number of degrees in column 1 3. The sine value for the degrees in column 4. The cosine value for the degrees in column 5. The tangent value for the degrees in column 6. Tangent values for 90 and 270 will be infinity • The 360 degrees row will always be the last row even if the increment value entered would not
[Bold] the code I do not…
2 In code, create a variable called strName and populate that variable with your name. Your code should then use a for loop to print the letters in strName. Then, print the number of letters in strName (using code to get that number of letters). My name is "LOL" so the output from my code would look like:
L
O
L
Chapter 5 Solutions
Microsoft Visual C#
Ch. 5 - A structure that allows repeated execution of a...Ch. 5 - The body of a while loop can consist of...Ch. 5 - Which of the following is not required of a loop...Ch. 5 - Prob. 9RQCh. 5 - Prob. 1ECh. 5 - Prob. 2ECh. 5 - Prob. 4ECh. 5 - Danielle, Edward, and Francis are three...Ch. 5 - Prob. 6ECh. 5 - Prob. 13E
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In Chapter 4, you created a program that generates a random number, allows a user to guess it, and displays a message indicating whether the guess is too low, too high, or correct. Now, create a modified program called GuessingGame2 in which the user can continue to enter values until the correct guess is made. After the user guesses correctly, display the number of guesses made. Recall that you can generate a random number whose value is at least min and less than max using the following statements: Random ranNumber = new Random(); int randomNumber; randomNumber = ranNumber.Next(min, max);arrow_forwardThe FKGLF is: 0.39(totalWords/totalSentences) + 11.8(totalSyllables/totalWords) - 15.59Using the FKGLF and your knowledge of how to input and output text files with Java, write an application that will: Take in a text file (anyText.txt), Correct the spelling then save to another file (anyTextCorrected.txt), Calculate the grade level. Outputs. Your solution needs to return: the number of words in the text, the number of spelling errors corrected with the misspelled words listed, the number of sentences in the text, the number of syllables in the text, and the Flesch-Kincaid Grade Level. One assumption you can make is the accuracy of SpellChecker(). You have access to the Java method SpellChecker that takes in a string, assumed to be a word, and returns a correctly spelled word. (Note: If the word returned is different than the word input, then there was a spelling error.) One Constraint: This program requires two classes: GradeLevel and GradeLevelTest. GradeLevel will be the…arrow_forwardFor Javascript, the prompt asks the following: Write a function that uses alert() to display pairs of number with one pair per line of the Celsius temperatures 0 through 20 and their Fahrenheit equivalents. The formula for converting a temperature from Celsius to Fahrenheit is F=(9/5)C+32 where F is the Fahrenheit temperature, and C is the Celsius temperature. Your function must use a loop to display the table.arrow_forward
- #include <fstream> #include <iostream> using namespace std; // PLACE YOUR NAME HERE const int MAXNAME = 20; int main() { ifstream inData; inData.open("grades.txt"); char name[MAXNAME + 1]; // holds student name float average; // holds student average inData.get(name,MAXNAME+1); while (inData){ inData >> average; // Fill in the code to print out name and // student average // Fill in the code to complete the while // loop so that the rest of the student // names and average are read in properly } return 0; }arrow_forwardI know it is a pain but I am looking for a kind stranger to add comments within the below C++ code, that explains what each line of code is doing. Please and Thank you C++ Source code: #include <iostream> #include <fstream> using namespace std; int main() { string input; ofstream outFile; outFile.open("CSC450_CT5_mod5.txt", ios::app); if (outFile.is_open()) { cout << "Enter a string to be stored in the file: "; getline(cin, input); outFile << input << endl; outFile.close(); } else { cout << "Error opening file" << endl; } ifstream inFile; ofstream outFile2; inFile.open("CSC450_CT5_mod5.txt"); outFile2.open("CSC450_mod5-2.txt"); if (inFile.is_open() && outFile2.is_open()) { string line; while (getline(inFile, line)) { outFile2 << line << endl; } inFile.close(); outFile2.close(); } else { cout << "Error opening file" << endl; } string reverse; ifstream inFile2; ofstream outFile3;…arrow_forward1. Please leave comments on the code below as explanations of what it does: def repeatChar(numRepeats, outputChar):'''output the outputChar numRepeats times'''for colNo in range(numRepeats):print(outputChar, end='')def Parrallelogram(side, char):for i in range(side):repeatChar(i+1, char)print()for i in range(side):repeatChar(i+1, ' ')repeatChar(side-i-1, char)print()def outlineParallelogram(side, char):for i in range(side):if (i < 1):repeatChar(1, char)elif(i == 1):repeatChar(2, char)else:repeatChar(1, char)repeatChar(i-1, ' ')repeatChar(1, char)print()for i in range(side-1):if (i == side-2):repeatChar(side-1, ' ')repeatChar(1, char)else:repeatChar(i+1, ' ')repeatChar(1, char)repeatChar(side-i-3, ' ')repeatChar(1, char)print()print('This program will show a parallelogram and its outline')number = int(input('How long do you want each side to be? '))character = input('Enter the character: ')Parrallelogram(number, character)outlineParallelogram(number, character)print()arrow_forward
- Create two variables (v1, v2). First and second ones should be your name---surname (string) and faculty number (integer), respectively.a) Combine v1 and v2 by using “+” operator and obtain new variable (v3) which should be string.b) Calculate length of the v3. Use print command to indicate the result.c) Find first, third and last elements of v3. Use print command to indicate the results.d) Print v1, length of v3 times with loop. You are free to choose loop type.arrow_forwardHow can you stop a program that has an endless loop? a. click FILE on the menu bar and then click Stop b. click DEBUG on the menu bar and then click Exit c. click DEBUG on the menu bar and then click Stop Debuggingd. none of the abovearrow_forwardGiven positive integer numInsects, write a while loop that prints, then doubles, numInsects each iteration. Print values < 200. Follow each number with a space. After the loop, print a newline. Ex: If numInsects = 16, print:16 32 64 128 #include <iostream>using namespace std; int main() { int numInsects; cin >> numInsects; // Must be >= 1 /* Your solution goes here */ return 0;}arrow_forward
- This is a program in C language. Help me debug this program. it has 3 errors. Please upload a screenshot also that it is working thank you./* This porgram uses the gotoxy() function and textcolor() for better screen display */ #include <iostream>#include <conio.h>#include <stdlib.h>using namespace std;main(){ int NoItem,ItemNo,Qty,ctr,Row=5; float UPrice,TAmt,ATendered,Change,APaid=0; char ItemDesc[15],TempChar; system("Color 5");; system("Color 2"); gotoxy(25,1);cout<< "[***] RICHLY SUPERMARKET [***]"; gotoxy(31,2);cout<< "Ayala Avenue, Makati"; gotoxy(6,4);cout<< "Item No. Description Qty. Unit Price Total Amount"; gotoxy(5,22);cout<< "No. of Item(s) Bought => [ ]"; gotoxy(37,22);cout<< "Total Amount to be Paid => "; gotoxy(37,23);cout<< "Amount Customer Tendered => "; gotoxy(37,24);cout<< "Amount of Change => "; gotoxy(31,22);cin>> NoItem;…arrow_forwardHow to make this run? // Flowers.cpp - This program reads names of flowers and whether they are grown in shade or sun from an input // file and prints the information to the user's screen. // Input: flowers.dat. // Output: Names of flowers and the words sun or shade. #include <fstream> #include <iostream> #include <string> using namespace std; int main() { // Declare variables here string flowerName, growingNeed; // Open input file ifstream fin;//create file object fin.open("flowers.dat");//open the file with its name int line = 0; // Write while loop that reads records from file. cout<<"Flower Need\n"; while(!fin.eof()){//repeat while end of the file //one line contarins name and next contarins its need if(line%2==0){ fin>>flowerName;//store flowerName cout<<flowerName<<" ";//print flowe name line++;//increment line no…arrow_forwardPlease i need it ASAP i will give you a thumbs up and thank you! Q7: A. What gets printed from the following program? #include <iostream> using namespace std; void f (int); int main () { f(3); return 0; } void f(int n) { static int x = 1; if (n <=1) return 0; f (n-1); x++; f (n-2); x++; cout << "x = " << x << " n = " << n << endl; return 0; } B. What is the difference between ++a and a++? C. What is a nested loop?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Control Structures - while loop - do-while loop - for loop - Goto - break - continue statements; Author: EzEd Channel;https://www.youtube.com/watch?v=21l11_9Osd0;License: Standard YouTube License, CC-BY