Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can't do 4 . 6 / / This header file provides exact - width integer types that allow for / / cross - platform portability.

Can't do 4.6
// This header file provides exact-width integer types that allow for
// cross-platform portability.
#include
// This header file provides functions that interface with standard
// input and ouput.
#include
// This header file provides functions to control serial output on the
// QUTy.
#include "qutyserial.h"
// This is the main function. It is the entry point for a C program.
int main(void)
{
// This function configures serial communication on the QUTy.
serial_init();
/** EX: 4.0
C is a strongly typed language in which variables must be declared
with a type.
The syntax for declaring a variable is:
;
We can also initialise a variable with a value using the syntax:
= ;
TASK: Write C code below to declare a variable called "c_release"
that represents an unsigned 16-bit integer, and initialise this
variable with the year that the C programming language was released.
*/
unsigned short c_release =1972;
/** CODE: Write your code for Ex 4.0 above this line. */
/** TODO: Uncomment the line below after Ex 4.0 is completed. */
printf("C was first released by Dennis Richie in the year %u.
", c_release);
/** EX: 4.1
C provides a number of arithmetic, logical, and bitwise operators
for performing operations on expressions.
Below is a partially implemented block of code that assigns a value
equal to the last two digits of your student number to the variable
"result".
TASK: Initialise the variables "x" and "parity" such that "result"
is assigned a value equal to the last two digits of your student
number.
EXAMPLE: If your student number was n12345678 then "result" should
be assigned the value 78.
*/
int16_t a =1;
int16_t b =3;
int16_t c =-50;
/** CODE: Write your code for Ex 4.1 below this line. */
int16_t x =-22;
uint8_t parity =1;
/** CODE: Write your code for Ex 4.1 above this line. */
uint8_t result;
if (parity)
{
result =(b - a)* x - c -1;
}
else
{
result =(b - a)* x + c;
}
printf("The result is %u.
", result);
/** EX: aaaaaaaaa4.6
Neptune's orbital period around the Sun is approximately 60,190
days, or 165 years.
TASK: Modify the expression below to increment the variable
"seconds_since_epoch" to the time of Neptune's next orbit after the
UNIX epoch, using the approximate orbital period of 60,190 days.
*/
seconds_since_epoch +=0;
/** CODE: Write your code for Ex 4.6 above this line. */
printf(
"Time of Neptune's next orbit after the UNIX epoch: %lu%09lu.
",
(int32_t)(seconds_since_epoch /1000000000),
(int32_t)(seconds_since_epoch %1000000000)
);
// END OF TUTORIAL04 EXERCISES //
// DO NOT EDIT BELOW THIS LINE //
while (1)
; // Loop indefinitely
}
The seconds_since_epoch was declared earlier in the code as an int32_t. And you cannot change the type of seconds_since_epoch. And there is a certain area where I have to edit to make this work for 4.6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

What is cost behavior?

Answered: 1 week ago

Question

6. Identify characteristics of whiteness.

Answered: 1 week ago

Question

e. What are notable achievements of the group?

Answered: 1 week ago