Question

rite statements to perform the following: (Hint: You may use combined assignment operators!) a. Add 9 to apples and store the result in apples. b. Divide peaches by 13 and store the result in peaches. c. Subtract 17 from oranges and store the result in oranges. d. Multiply payRate by 1.5 and store the result in payRate. 9. Write statements to perform the following operations: Declare two variables p and q. Subtract 250 from p and store the result in q. a. Answer b. Declare three variables x, y and z. Divide the sum of x and y by 4.25 and store the result in z. Answer Declare a variable to store the character J c.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution :-

8. a. Add 9 to apples and store the result in apples.

int apples;

apples += 9; which is equivalent to apples = apples + 9;

b. Divide peaches by 13 and store the result in peaches.

int peaches;

peaches /= 13; which is equivalent to peaches = peaches / 13;

c. Subtract 17 from oranges and store the result in oranges.

int oranges;

oranges -= 13;   which is equivalent to oranges = oranges - 13;

d. Multiply payRate by 1.5 and store the result in payRate.

float payRate;

payRate *= 1.5; which is equivalent to payRate = payRate * 1.5;

9.

a. Declare two variables p and q. Subtract 250 from and store the result in q.

int p, q;

q = p - 250;

b. Declare three variables x, y and z. Divide the sum of x and y by 4.25 and store the result in z.

float x, y, z;

z = (x+y) / 4.25;

c. Declare a variable to store a character J.

char a = 'J';

Add a comment
Know the answer?
Add Answer to:
rite statements to perform the following: (Hint: You may use combined assignment operators!) a. Add 9...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a single C++ statements to accomplish each of the following tasks: In one statement, assign...

    Write a single C++ statements to accomplish each of the following tasks: In one statement, assign the sum of the current value of x and y to z and postincrement the value of x. Determine whether the value of the variable count is greater than 10. If it is, print “Count is greater than 10.”. Pre-decrement the variable of x by 1, then subtract it from the variable total. Multiply variable power by x and assign the result to power.  ...

  • You shall develop a grammar and implement a parser which recognizes valid statements as described below in the assignment specification. You may develop your code using C, C++. The test file include...

    You shall develop a grammar and implement a parser which recognizes valid statements as described below in the assignment specification. You may develop your code using C, C++. The test file include these expressions below. The first six should pass and the rest should fail: first = one1 + two2 - three3 / four4 ; second = one1 * (two2 * three3) ; second = one1 * (two2 * three3) ; third = ONE + twenty - three3 ; third...

  • Create a basic math quiz program that creates a set of 10 randomly generated math questions for the following operations:

    Create a basic math quiz program that creates a set of 10 randomly generated math questions for the following operations:AdditionSubtractionMultiplicationDivisionModuloExponentThe following source files are already complete and CANNOT be changed:MathQuiz.java (contains the main() method)OperationType.java (defines an enumeration for valid math operations and related functionality)The following source files are incomplete and need to be coded to meet the indicated requirements:MathQuestionable.javaA Random object called RANDOM has already been declared and assigned, and you must not change this assignment in any way.Declare and assign an interface integer called MAX_SMALL and assign it the...

  • Create a basic math quiz program that creates a set of 10 randomly generated math questions for the following operations:

    Create a basic math quiz program that creates a set of 10 randomly generated math questions for the following operations:AdditionSubtractionMultiplicationDivisionModuloExponentThe following source files are already complete and CANNOT be changed:MathQuiz.java (contains the main() method)OperationType.java (defines an enumeration for valid math operations and related functionality)The following source files are incomplete and need to be coded to meet the indicated requirements:MathQuestionable.javaA Random object called RANDOM has already been declared and assigned, and you must not change this assignment in any way.Declare and assign an interface integer called MAX_SMALL and assign it the...

  • This is java and make simple program. CPSC 1100. Thanks CSPS 1100 Lab 4 ay total...

    This is java and make simple program. CPSC 1100. Thanks CSPS 1100 Lab 4 ay total Also I would need a new name for the daubles. An example here might be double tRtalD-caradd xD, YD) 1. (a) We are going to begin with some simple math, reading input, and formatted output. Create a class called MuCalsustec Yau will not have an instance variable. Since you have no instance variables to initialize, you do nat need a constructar. Do NOT create...

  • Implement the following statements using MS430 assembly instructions. You may use more than one, ...

    Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...

  • Programming Assignment #2 EE 2372 MAKE SURE TO FOLLOW INSTRUCTIONS CAREFULLY, IF YOU HAVE ANY DOUBTS...

    Programming Assignment #2 EE 2372 MAKE SURE TO FOLLOW INSTRUCTIONS CAREFULLY, IF YOU HAVE ANY DOUBTS PLEASE EMAIL ME! This programming assignment will just be a small extension to programming assignment 1. In the first assignment each of the functions could only take a predefined number of inputs. This time the objective is to be able to complete these functions with any amount of inputs. The user will pass arguments through the command line (this means you will have to...

  • Use the following information to answer questions 9 and 10. You must decide between the following...

    Use the following information to answer questions 9 and 10. You must decide between the following two potential altermatives using Rate of Return Analysis. MARK-12%, Alternative #1 25,000 Alternative W 40,000 Initial C Benefits O&M Costs Salvage Life (in years) $11,000 per year $10,000 per year $3,000 per year S2,000 per year $5,000 5,000 16.27% 9. The ROR for Alternative w2 is closest to... a) 13.25% b) 32.5% C) 1 1.81% d)20% e) 25% 012.47% g) 6.34% h) 18.77% i)...

  • Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p;...

    Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p; int i; int k; i = 42; k = i; p = &i; After these statements, which of the following statements will change the value of i to 75? A. k = 75; B. *k = 75; C. p = 75; D. *p = 75; E. Two or more of the answers will change i to 75. Consider the following statements: int i =...

  • tlons: Match each of the statements below with its proper terms may not be used Some...

    tlons: Match each of the statements below with its proper terms may not be used Some A. account B. assets C. balance of the account D. chart of accounts E. credits F. debits G. double-entry accounting H. drawing O. liabilities P. materiality concept Q. objectivity concept R. owner's equity S. posting T. revenues U. slide V. T account W. transposition X. trial balance J. horizontal analysis K. journal L. journal entry M. jounalizing Y. two-column journal Z uneaned revenue AA....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT