Concept explainers
The variable a starts with the value 10.
The variable b starts with the value 2.
The variable c starts with the value 4.
Store the value of a rimes b in a.
Store the value of b times c in c.
Add a and c, and store the result in b.
Display the value in b on the screen.
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (8th Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Digital Fundamentals (11th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- Problem Statement for Picture Frame Program A piece of wire is to be bent in the form of a rectangle to put around a picture frame. The length of the picture frame is 1.5 times the width. Write a program that asks the user to enter the length of the wire and outputs the length and width of the picture frame. Part 1. Understand the ProblemThe problem gets the length of the wire for the frame from the user. The ratio of length to width of the frame is a constant (1.5). The length and width of the picture frame that are to be calculated and displayed. The length of wire represents the perimeter of the rectangular picture frame. The equation for the perimeter of a rectangle is: Perimeter = 2 * (length + width) This is an equation with two unknowns, but the ratio of the lengthto the width (length = ratio * width) so substitute for length in the perimeter equation and solve for width: Perimeter = 2 * (ratio * width + width) ratio * width + width = Perimeter / 2 width * (ratio + 1) =…arrow_forward(Physics) Coulomb’s Law states that the force, F, acting between two electrically charged spheres is given by this formula: F=kq1q2r2 q1isthechargeonthefirstsphere.q2isthechargeonthesecondsphere.risthedistancebetweenthecentersofthetwospheres.kisaproportionalityconstant. Write an assignment statement to calculate the force, F.arrow_forwardQ3a) Summary Newton’s law states that the force, F, between two bodies of masses M1 and M2 is given by: in which k is the gravitational constant and d is the distance between the bodies. The value of k is approximately 6.67 X 10-8 dyn. cm²/g² . Instructions Write a program that prompts the user to input: The masses of the bodies The distance between the bodies. The program then outputs: The force between the bodies. Your program should be able to work with decimals. Q3b) Cindy uses the services of a brokerage firm to buy and sell stocks. The firm charges 1.5% service charges on the total amount for each transaction, buy or sell. When Cindy sells stocks, she would like to know if she gained or lost on a particular investment. Instructions Write a program that allows Cindy to input: The purchase price of each share The selling price of each share The number of shares sold The program outputs: The total amount invested The total amount received from selling The total service…arrow_forward
- Q: Write a program which reads two integer values. If the first is less than the second, print the message up. If the second is less than the first, print the message down If the numbers are equal, print the message equal. (Visual Basic)arrow_forwardWrite assignment statements that perform the following operations with the variables a and b (Python)A. Adds 2 to a and stores the result in bB. Multiplies b times 4 and stores the result in aC. Divides a by 3.14 and stores the result in bD. Subtracts 8 from b and stores the result in aarrow_forwardstate = !state; } Example We want to write a code when SW1 closed, the Motor run with clockwise and when SW2 close, the motor run anticlockwise.arrow_forward
- Q1. FizzBuzz problem:- Write a program which return "fizz" if the number is a multiplier of 3, return "buzz" if its multiplier of 5 and return "fizzbuzz" if the number is divisible by both 3 and 5. If the number is not divisible by either 3 or 5 then it should just return the number itself? .arrow_forwardHW7: Write a program in C language for the students Grading System: If the mark is less than 50 print "Fail" If the mark is between 50 and 59 print "Pass" If the mark is between 60 and 69 print "Medium" If the mark is between 70 and 79 print "Good" If the mark is between 80 and 89 print "Very Good" If the mark is between 90 and 100 print "Excellent" If the mark been entered over 100 you will get the following message "Can you kindly enter the mark between 0 to 100"arrow_forward01/ Choose the correct answer. 1- The - -- is installed after the completion of the well and is used to control the flow of oil and gas. a BOP b- conductor pipe c- Christmas tree d- casing pipe 2-The long and wide piece of casing which is the first string to be inserted in the hole is known as a ******** a drill collars b- conductor pipe e- drill pipe d- casing pipe 3. ......... pipe transfer the spin and circulation between the pipe and the drill bit. a- BHA b- Drill e- Heavy d- Casing 4- a- Drilling Mud b- Cement e- Chemical d- none of above 5- During drilling process many faults might occur. If an engineer forgot an item in the wellbore, it could be removed by a process called - a-kicking b-drilling e-casing d-fishing 6- The layer produced from the drilling mud on the sides of the borehole and forms during filtration is slurry consists of cement slurry, water, and additives. mulsion b- filter cake a- e- cement slurry d- formation fluid 7- When a phase is equally spread into another…arrow_forward
- A and BonlyIn this program, you are asked to write a program in assembly which works as a simple calculator.The program will get two integer numbers, and based on the requested operation, the result shouldbe shown to the user.a. The program should print a meaningful phrase for each input, and the result.i. “Enter the first number”ii. “Enter the second number”iii. “Enter the operation type”iv. “The result is”b. The user should enter 0, 1, and 2 to tell the program the types of operation add, sub, andmultiply, respectively.c. How many registers do you need to implement this program?d. What system calls do you need to write this program?arrow_forwardComputer Science Godot Programming Programming Problem 1. Rock, Paper, Scissors This is your traditional rock-paper-scissors game, where two players select one of the three options and a result is produced based on their selection. For reference: Rock beats scissors Paper beats rock Scissors beats paper For this problem, you are to assume that two human players will play against each other and will input their choices accordingly. The input for each player will be in the form of buttons. Once a player clicks on a button, the rest of their buttons are locked in place (i.e. disabled). Once the other player selects their pick, the program outputs who won or if there was a draw. This isn’t exactly the most realistic way to code the game as it would be better if both players made their choice at the same time, but we’ll just have to chalk this up as a limitation for our exam. Aside from the game itself, the program should track the score of each player. Basically, if one wins, that…arrow_forwardNAME Circle the letter of the best answer to the question below. 1. An atom with the same number of electrons and protons a. will also have the same number of neutrons. b. will not have an electrical charge. bas c. will have a neutral charge. d. Both b and c Choose a word or words from the box to complete each sentence below. electricity electrons negative attract friction positive protons repel charge, and protons have a 2. Electrons have a charge. 3. Rubbing two materials together creates which causes electrons to move. 4. is electrons moving from one atom to another. 5. An atom will have a negative charge if it has more than 6. Positive charges negative charges, but two negative charges will budw each other. ite your answer on the lines below. Using information from the selection, explain why wool socks that have just come out of a clothes dryer will stick to a pair of nylon-running pants. ing Concepts and Processes mes, when a person pulls a sweater over his or her head, friction…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning