HW1 ASSIGNMENT

HW代写 You will be writing a program in Java and a program in C. You will be required to write functions which display output to the user.

HW代写
HW代写

WHAT TO DO?   HW代写

You will be writing a program in Java and a program in C. You will be required to write functions which display output to the user. The functions to implement in the hw1.java file are:

void baseout (long number, long base, PrintStream stream);

void decout (long number, PrintStream stream);

void newline (PrintStream stream);

long writeline (String message, PrintStream stream);

The functions to implement in the hw1.c file are:

void baseout (long number, long base, FILE * stream);

void decout (unsigned long number, FILE * stream);

void newline (FILE * stream);

long writeline (const char * message, FILE * stream);

FUNCTION DESCRIPTIONS  HW代写

baseout:

The baseout function takes the long integer number provided by the user, converts it to the base that is passed in, and displays it to the filestream stream. This requires separating the number into individual characters, converting each character into its digit value, and then displaying the result. The algorithm will be explained fully in class. The key to writing this method is knowing that modding a number by its base will return one digit, and dividing a number by its base will remove that digit. You may want to use a loop. HW代写

Values of number are expected to be any positive integer.

Values of base are expected to be any positive integer.

Values of stream are expected to be either stdout or stderr in hw1.c ( System.out and System.err in hw1.java ).

decout:

The decout function takes the long integer number provided by the user and displays it to the filestream stream as an integer. This requires separating the number into individual characters, converting each character into its digit value, and then displaying the result. This should be implemented by delegating to baseout. HW代写

Values of number are expected to be any positive integer.

Values of stream are expected to be either stdout or stderr in hw1.c ( System.out and System.err in hw1.java ).

newline:

Displays a newline character (‘\n’) to the filestream stream. You’ll want to use fputc. This method shouldn’t take more than a single line of code to implement. HW代写

Values of stream are expected to be either stdout or stderr in hw1.c ( System.out and System.err in hw1.java ).

writeline:

Displays the string message to the user via the filestream stream. This method should be implemented using a loop making calls to fputc. HW代写

  • Values of messageare expected to be a NULL terminated character arrays.
  • Values of streamare expected to be either stdout or stderr in hw1.c ( System.out and System.err in hw1.java ).

IMPLEMENTATION RESTRICTIONS HW代写

To implement these functions, you may not make calls to ANY functions you did not author except for fputc. You may call on the String methods charAt and length for hw1.java. fputc is a built-in method in the C library, but it is not built-in in Java. However, it has been implemented for you in hw1.java. For more information about fputc, refer to the documentation for it: cplusplus or look at the man page by typing man fputc into the command prompt or into Google. If you don’t remember how charAt or length works, here is a link to the API: API for String class

GRADING BREAKDOWN HW代写

Ask a tutor to check your homework when you are done. The tutor will only check off each component below once it is complete. If a component is not complete when you ask for checkoff, you can complete what is missing and ask for checkoff again. Failure to get checked off may cost you points in future homeworks as this is the fastest way to correct any misunderstandings and oversights you may have.

writeline:

10 pts

decout/baseout:

10 pts

style/documentation:

5pt deduction each if absent

HOW TO GET STARTED? HW代写

Copy and paste the following commands into your terminal.

cd

cd ../public/hw1

make directories

make install

cd

cd hw1

mv hw1.java.empty hw1.java

mv hw1.c.empty hw1.c

ls

 

HW代写
HW代写

更多其他:代写CS  数据分析代写   Assignment代写 Essay代写 研究论文代写 期末论文代写 毕业论文代写 论文代写 文学论文代写 商科论文代写 艺术论文代写

合作平台:天才代写 幽灵代写  写手招聘