Concept explainers
Consider the following C program
void fun (void) {
int a, b, c; /* defiinition.1 */
. . .
while (. . .)
int b, c, d; /* definition 2 */
. . . <---------------------- 1
while (…) {
int c, d, e; /* definition 3 */
. . . <------------------2
}
. . .<------------------3
}
. . . <------------------4
}
For each of the four marked points in this function, list each visible variable, along with the number of the definition statement that defines it.
Learn your wayIncludes step-by-step video
Chapter 5 Solutions
Concepts Of Programming Languages
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
C Programming Language
Starting out with Visual C# (4th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with C++: Early Objects
- complete a prewritten C++ program for a carpenter who creates personalized house signs. The program is supposed to compute the price of any sign a customer orders, based on the following facts: The charge for all signs is a minimum of $35.00. The first five letters or numbers are included in the minimum charge; there is a $4 charge for each additional character. If the sign is made of oak, add $20.00. No charge is added for pine. Black or white characters are included in the minimum charge; there is an additional $15 charge for gold-leaf lettering. Instructions Ensure the file named HouseSign.cpp is open in the code editor. You need to declare variables for the following, and initialize them where specified: A variable for the cost of the sign initialized to 0.00 (charge). A variable for the number of characters initialized to 8 (numChars). A variable for the color of the characters initialized to "gold" (color). A variable for the wood type initialized to "oak" (woodType).…arrow_forwardUse java Language Write the function parrotTrouble.** We have a loud talking parrot. The "hour" parameter* is the current hour time in the range 0..23. We are* in trouble if the parrot is talking and the hour* is before 7 or after 20. Return true if we are* in trouble.** Some Examples:* parrotTrouble(true, 6) returns true* parrotTrouble(true, 7) returns false* parrotTrouble(false, 6) returns false** @param isTalking true if the parrot is talking.* @param hour the time of day from 0..23.* @return true if you're in trouble with your neighbors.arrow_forward4.31 LAB: Months until payoff (JAVA) Write a program in java that reads a loan amount, payment amount, and interest rate as inputs and outputs the number of payments required until the loan is paid. Interest is added to current balance before a payment is applied. Ex: If current balance is $100.00 and the interest rate is 0.02, the new balance is $102.00 before a payment is applied. All values are doubles. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /* Type your code here. */ }}arrow_forward
- HASKELL PROGRAMMING LANGUAGE QUESTION PLEASE Rock-paper-scissors is a game for two players. Each player chooses an action without knowledge ofthe other’s choice. If the players choose the same action then there is a draw. Otherwise the winneris determined by the following rules: paper beats rock, rock beats scissors, and scissors beats paper.you are going to make a playable Rock-Paper-Scissors game and consider multiplayer tournaments • Please put comments in your code to show what you are answering with each piece ofcode. • You may create auxiliary functions if you like. You may use library functions from Haskell’sstandard library.• Please limit your line lengths to 100 characters max. Please use the following two data types which you can copy-and-paste into your code.data Action = Rock | Paper | Scissors deriving (Eq, Show)data Outcome = Player1Win | Player2Win | Draw deriving ShowAction represents a player’s chosen action and Outcome represents the outcome of playing a game…arrow_forward*************Question below: ------------------------ Code in Java. Code must be recursive. *DriverMain.java: import java.util.*; import java.lang.*; import java.io.*; //Program is to be evaluated by the DriverMain class and test cases. public class DriverMain { public static void main (String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); int A[] = new int[N]; for (int i = 0; i < N; i++) { A[i] = s.nextInt(); } ProblemSolution problemSolution = new ProblemSolution(); System.out.print(problemSolution.findMagicIndex(A, N)); } } *ProblemSolution.java: import java.util.*; import java.lang.*; import java.io.*; class ProblemSolution { public static int findMagicIndex(int[] a, int n) { //CODE GOES HERE } } *entrypoint.cz: DriverMain.javaarrow_forwardMultiple choice and True/False Java is a ___________ language, which means that it allows only values of compatible data types to be stored in variables.a. case-sensitiveb. strongly typedc. object-orientedd. a and carrow_forward
- A C++ program that inputs the names and monthly salaries of 10 employees. The programchecks annual salary of each person. If annual salary is greater than or equal to Rs. 250000/-then it prints name, salary and a message ‘Tax to be paid’ else it prints name, salary and amessage ‘No tax’. Using pointers.arrow_forwardPart 2 only please!!! C++ Language. Part 1: As an avid Monopoly player, I've often wondered what the most common dice rolls are when you roll 2 6-sided dice and sum the result. To answer this question experimentally, write a program that asks the user how many trials they would like to run. Then, simulate the roll of 2 six-sided dice using rand() repeatedly, according to how many trials the user wanted to run. Finally, report the percentage of how many of the trials yielded a given sum for each of the possible sums from 2 to 12. Here is an example run: Each time the result for 1 die comes out and it’s 1 assign it the value of 1/num throws How many times do you want to throw a pair of six-sided dice? > 1000 The distribution of results from the 1000 trials is: (the numbers below are not actually correct) 2: .01 3: .04 4: .50 5: .10 6: .20 7: .30 8: .10 9: .10 10: .50 11:…arrow_forwardComputer Science JAVA: If you wanted to test two variables for equivalency, what operator do you use? Give two circumstances in which that operator does not perform as expected, and why.arrow_forward
- I am attempting to learn three different computer languages. Python, Java, and C++. I study Udemy courses to help myself understand concepts for each of these languages. I know that placing the main function at the bottom of a program is better for C++ languages. Is this true for every language? Is having the main function at the bottom of the program a top down or bottom up style? I am struggling with understanding method overloading. How is this top down, or vice versa, style of programming better for method overloading? Method overloading is still a bit of a puzzle to me. In a python course on Udemy I was told that the compiler starts at the very end of the program feeding the data from the bottom end first before it translates. This is why bottom up is better for overloading, right?arrow_forwardCourse Title: Modern Programming Language Please Two Part Answers Question (a) Briefly define try-catch-finally block in Java. Give programming examples (b) Why super keyword is used in Java? Give programming examples to show the use of super keywordarrow_forwardUse haskell haskell haskell haskell to solve the following Oddities problem Some numbers are just, well, odd. For example, the number 3 is odd, because it is not a multiple of two. Numbers that are a multiple of two are not odd, they are even. More precisely, if a number n can be expressed as n=2⋅k for some integer k, then n is even. For example, 6=2⋅3 is even. Some people get confused about whether numbers are odd or even. To see a common example, do an internet search for the query “is zero even or odd?” Write a program to help these confused people. Input Input begins with an integer 1≤n≤20 on a line by itself, indicating the number of test cases that follow. Each of the following n lines contain a test case consisting of a single integer −10≤x≤10. Output For each x, print either ‘x is odd’ or ‘x is even’ depending on whether x is odd or even. Sample Input 1 Sample Output 1 3 10 9 -5 10 is even 9 is odd -5 is oddarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT