GSP 115 DeVry Week 1 Assignment Latest

admin   June 30, 2017   Comments Off on GSP 115 DeVry Week 1 Assignment Latest

GSP 115 DeVry Week 1 Assignment Latest

Downloading is very simple, you can download this Course here:

http://wiseamerican.us/product/gsp-115-devry-week-1-assignment-latest/

Or

Contact us at:

SUPPORT@WISEAMERICAN.US

GSP 115 DeVry Week 1 Assignment Latest

GSP115

GSP 115 DeVry Week 1 Assignment Latest

GSP 115 DeVry Week 1 Assignment Latest

Simple Data Types

Instructions

Complete the following assignments. Cut and paste your finished code into a Word document, clearly identifying which assignment it is. Also, capture the output of the program and paste that into the Word document. If there are questions to be answered, put the answers after the output. When you complete all three of this week’s assignments, save the document as yourLastName_GSP115_W1_Assignments.docx. Submit it to the Week 1 assignment Dropbox.

  1. Compile Time Bugs (TCO 4)

Find and fix the four (possibly five) compile time bugs in the code at the end of this section. Compile time bugs shown as errors when you compile, but the Visual Studio IDE also gives you visual clues in the form of red squiggly underlines, as shown here. You will actually see more than five errors, but they are all caused by just four or five bugs. There is a case where you have either two bugs or one, depending on what you think the error is. In one case, it can be fixed with a single change. In the other case, it will take two changes to fix the problems.

Here is the code.

Here is the code.

// Week 1 Assignment-1

// Description: Compile time errors with simple variables

//———————————-

//**begin #include files************

#include// provides access to cin and cout

//–end of #include files———–

//———————————-

//**begin global constants**********

// NO GLOBALS

//–end of global constants———

//———————————-

usingnamespacestd;

//———————————-

//**begin main program**************

int main()

{ // Initialize variables

int 1IntVar;

int x = “Four”;

char y = “a”;

float z1 = 4.756f

z2 = 7.45f;

// Print out the values

1IntVar = x;

cout<<“1IntVar = “<< 1IntVar

  1. Numbers and Conversions (TCO 4)

The following has one compile time bug. This bug only generates a warning in some compilers and would cause an exception during runtime. Visual Studio 2012 actually gives us an error at compile time. This is better, because you should never do the thing that causes this error. Fix the error and run the program. Compare the output to the code and answer the questions found after the code.

Here is the code.

// Week 1 Assignment-2

// Description: Numbers and conversions with simple variables

//———————————-

//**begin #include files************

#include// provides access to cin and cout

#include

//–end of #include files———–

//———————————-

usingnamespacestd;

//———————————-

//**begin main program**************

int main()

{ // create and initialize variables

int x, y;

float f1 = 1.6767676f;

float f2 = 2.2f;

float diff;

// demonstrate math and number output

x = y;

x = f1; // What happens when you store a float into an int?

y = f2; // Does it round or truncate?

// display ints

cout<<“—>using default cout settings: “<

Questions

  1. When storing a floating point number into an integer variable, does it truncate or round?
  2. When the floating point numbers were printed out at higher precision, they were not the same value as entered. Research this issue and explain why.
  3. Thesetprecision(12) command either sets the precision for 12 places after the decimal point or 12 digits total; select the right option for each case below.
  4. fixed [total/after the decimal point]
  5. scientific [total/after the decimal point]
  6. float [total/after the decimal point]
  7. Based on the results of taking the square root and then squaring again, what would you say about the accuracy of floating point arithmetic in C++?
  8. Dividing by zero in earlier compilers generates an error and an exception. What does Visual Studio 2012 produce as the result of dividing by zero?
  9. Create a Program FromPseudocode (TCO 1)

This exercise will be to use pseudocode (in the form of comments) to write a program that creates and initializes the variables for a computer role-playing game character generator. This will only setup the variables. It is slightly different from our iLab assignment. You can make up your own variable names.

Here is the pseudocode.

// Week 1 Assignment-3

// Description: Setup Variables for CRPG Character Generator

//———————————-

//**begin #include files************

#include// provides access to cin and cout

//–end of #include files———–

//———————————-

//**begin global constants**********

//–end of global constants———

//———————————-

usingnamespacestd;

//———————————-

//**begin main program**************

int main()

{

//**Enter code staring here

// Create Variables

// character ID [integer] initialized to 0

// strength [integer] initialized to 80

// armor [integer] initialized to 70

// health [float] initialized to 1.0f

// flag to indicate if the character is dead or alive [Boolean] initialized to true

// Print out each of the variables.

//**End of your code

// Wait for user input to close program when debugging. cin.get(); return 0; }

//–end of main program————-

//———————————-