Concept explainers
To write:
An “if” statement that would print “Hey, you get overtime!” if the value of a variable hours is greater than 40. Test the “if” statement for values of hours less than, equal to, and greater than 40.
Answer to Problem 4.1P
Solution:
Print the statement “Hey, you get overtime!” if the value of the variable time is greater than 40.
Explanation of Solution
MATLAB Code:
clc
clear all
close all
Variable_Time_in_Hours = input('Enter Variable Time in Hours: ');
% Define the instruction to enter the variable time in hours.
if Variable_Time_in_Hours > 40
% Define the instruction to get the variable time in hours greater than 40.
fprintf('Hey, you get overtime!\n');
% Define the command to generate the statement "Hey, you get overtime!".
end
Save the MATLAB script with name, chapter4_54793_4_1P.m in the current folder. Execute the script by typing the script name at the command window to write an “if” statement that would print “Hey, you get overtime!” if the value of a variable hours is greater than 40. Test the “if” statement for values of hours less than, equal to, and greater than 40.
Result:
Therefore, print the statement “Hey, you get overtime!” if the value of the variable time is greater than 40.
Want to see more full solutions like this?
Chapter 4 Solutions
Matlab, Fourth Edition: A Practical Introduction to Programming and Problem Solving
- Construct a frequency distribution for the given data set using 6 classes. In the table, include the midpoints, relative frequencies, and cumulative frequencies. Which class has the greatest frequency and which has the least frequency? Question Viewer Amount (in dollars) spent on books for a semester 422 106 355 400 381 411 106 50 62 511 394 54 381 505 437 359 267 311 268 115 407 413 192 252 80 454 107 330 486 Complete the table, starting with the lowest class limit. Use the minimum data entry as the lower limit of the first class. (Type integers or decimals. Round the class limits to the nearest whole number. Round all other values to the nearest thousandth as needed.) Class 50-126 Frequency 9 Midpoint 88 Relative Frequency Cumulative Frequency 0.333 9arrow_forwardTo assure 99% confidence another poll is conducted, again asking whether or nothuman cloning should be allowed. 5,000 randomly selected adults from across thenation are surveyed. Of those surveyed 4,388 respond that they are against humancloning. Construct a 99% confidence interval estimate for the proportion of adults whoare against human cloning. Does this interval support the newspaper’s claim?arrow_forwardCould you help me please. Thank you!arrow_forward
- Can you help me with it please.arrow_forwardIn a recent national poll consisting of 1012 randomly selected adults. Participants wereasked whether or not human cloning should be allowed. Of those surveyed 900indicated human cloning should not be allowed. A newspaper releases and articleclaiming 90% of those across the nation are against human cloning based on thenational poll. Construct a 95% confidence interval estimate for the proportion of adultswho are against human cloning. Does this interval support the newspaper’s claim? What sample size would be needed to assure 99% confidence with an error bound of 0.02?arrow_forwardIn a recent national poll consisting of 1012 randomly selected adults. Participants wereasked whether or not human cloning should be allowed. Of those surveyed 900indicated human cloning should not be allowed. A newspaper releases and articleclaiming 90% of those across the nation are against human cloning based on thenational poll. Construct a 95% confidence interval estimate for the proportion of adultswho are against human cloning. Does this interval support the newspaper’s claim?arrow_forward
- It is known that 30% of all households still have landlines. If we randomly select 10 households, let X = number that have landlines a) FInd the probability that X = 3. b) Find the mean and standard deviation of X.arrow_forwardplease answer and show workarrow_forwardPlease answer and show workarrow_forward
- please answer and show workarrow_forwardSuppose you want to have $300,000 for retirement in 25 years. Your account earns 8% interest. a) How much would you need to deposit in the account each month? SA $ b) How much interest will you earn? $1 Message instructor Enter an integer or decimal number [more..] Question Help: Video Submit Question esc ! 1 F1 F2 80 F3 # $ 2 3 4 Ơ ☑ F4 F5 % <6 olo 50 F6 A F7 Q W E R T Y ab A lock Z S X D C 7 LL F G Harrow_forwardplease answer and show workarrow_forward
- Holt Mcdougal Larson Pre-algebra: Student Edition...AlgebraISBN:9780547587776Author:HOLT MCDOUGALPublisher:HOLT MCDOUGALElementary AlgebraAlgebraISBN:9780998625713Author:Lynn Marecek, MaryAnne Anthony-SmithPublisher:OpenStax - Rice UniversityAlgebra: Structure And Method, Book 1AlgebraISBN:9780395977224Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. ColePublisher:McDougal Littell
- Mathematics For Machine TechnologyAdvanced MathISBN:9781337798310Author:Peterson, John.Publisher:Cengage Learning,College Algebra (MindTap Course List)AlgebraISBN:9781305652231Author:R. David Gustafson, Jeff HughesPublisher:Cengage Learning