For each data type learned write down a literal of that type

For each *data type* learned, write down a literal of that type. Which are primitive types? Are any reference/class types? Give examples of our uppercase (named constants), camel case (variables), and Pascal case (classes) naming conventions. Write an expression that Use int division (/) and modulus (%). Force an int result in a floating-point calculation with a \"cast*. Also, using one of the Math class methods. Write a statement using combined assignment (e.g., /=). Then, rewrite it using just = and/.

Solution

Hi, I am assuming that your programing language is C++.

6)
   Integer literal: 2, 3, 14, etc
   Floating Point literals: 34.56f, 12.09f etc
   Double type literals: 123.21d, 543.23, 432.12 etc
   Character literals: \'1\', \'y\' etc
   String literals: \"this\", \"boy\" etc

   String is class type, all others are primitive types

7)
   const int OUT = 1; // uppercase named constant
   int isDigit = 0; // cammel case variable
   Student s; // Pascal case

8)
   int x = 3;
   int y = 2;

   int div = x/y;
   int mod = x%y;

9)
   int x = 3;
   int y = 2;

   float div = (float)x/(float)y;

10)
   int x = 3;
   int y = 2;

   x /= y;

   x = x/y;

 For each *data type* learned, write down a literal of that type. Which are primitive types? Are any reference/class types? Give examples of our uppercase (name

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site