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
  • Create a python add the following functions below to the module. Each section below is a...

    Create a python add the following functions below to the module. Each section below is a function that you must implement, make sure the function's names and parameters match the documentation (Copy-Paste). DO NOT put the functions in an if-name-main block. 1. def productSum(x: int, y: int, z: int) -> int This function should return: The product of x and y, if the product of x and y is less than z. Else it should return the sum of x...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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 =...

  • This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation...

    This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation inside a class. Task One common limitation of programming languages is that the built-in types are limited to smaller finite ranges of storage. For instance, the built-in int type in C++ is 4 bytes in most systems today, allowing for about 4 billion different numbers. The regular int splits this range between positive and negative numbers, but even an unsigned int (assuming 4 bytes)...

  • Adv. Java program - create a math quiz

    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...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

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
ADVERTISEMENT