Learning Objectives This case tests the following programming skills: Convert te
ID: 3588343 • Letter: L
Question
Learning Objectives
This case tests the following programming skills:
Convert textual data to numeric data.
Call intrinsic functions, pass data to those functions, and process the data returned by those functions.
Enable and disable groups of controls.
Case Summary
This case requires that you call several Visual Basic financial functions. Some of these functions you used in the lab. Others you did not. See the resources section for a link to a Microsoft Help page.
FV: Returns a Double specifying the future value of an annuity based on periodic, fixed payments and a fixed interest rate.
PV: Returns a Double specifying the present value of an annuity based on periodic, fixed payments to be paid in the future and a fixed interest rate.
NPer: Returns a Double specifying the number of periods for an annuity based on periodic fixed payments and a fixed interest rate.
Rate: Returns a Double specifying the interest rate per period for an annuity.
Sln: Returns a Double specifying the straight-line depreciation of an asset for a single period.
You need to create a user interface that operates in different modes. There should be one mode for each of the above financial functions. The mode should be set by clicking mode buttons across the top of the form. When a mode is selected, the input control instances needed by the desired function should be enabled or made visible. Unnecessary control instances should be hidden or disabled. The output controls should be enabled / disabled too. You will need another button or group of buttons that will actually perform the calculation desired calculation when clicked.
Case Requirements
Create buttons across the top of the form or along the left margin to set the current mode. Enable / disable or hide show the appropriate input controls and prompts. If you want to look ahead, you can use procedures to do this. If you prefer, you can use menus to do this.
Create a button or buttons to perform the calculations based on the current mode. Based on what you know so far, it will be easiest to create one button for each business function you are performing.
Build the user interface such that the prompts and input controls are aligned. Numeric values should be right justified. Numeric output should be formatted with two decimal places. Use a clean and consistent color and font scheme.
Display the current date at the bottom of the form.
Display along the bottom of the form, the number of hours, minutes, and seconds that the program has been running. use a timer to update the value.
Resources
The following page contains an index of the Microsoft.VisualBasic.Financial functions among others: https://msdn.microsoft.com/en-us/library/c157t28f(v=vs.90).aspx (Links to an external site.)Links to an external site.
You should have used most of these functions from Excel. The following is an excellent link to the Excel financial functions. Both the Excel and VB functions work the same way: http://www.tvmcalcs.com/index.php/calculators/excel_tvm_functions/excel_tvm_functions_page1 (Links to an external site.)Links to an external site.
Explanation / Answer
#define read_buffer_size 8192
int main(int argc, char* argv[])
{
//file descriptor for opening and closing
int file_descriptor; //size of buffer for file reading
char read_buffer[read_buffer_size];
ssize_t read_bytes;
//looping through all files given in argument
int i;
for(i=1;i {
//using linux system call open file with readonly flag
file_descriptor = open (argv [i], O_RDONLY);
//if file not opened
if (file_descriptor == -1)
{
perror ("open");
printf("file can not be opened : %s ",argv[i]);
}
else
{
while((read_bytes = read (file_descriptor, &read_buffer, read_buffer_size)) > 0)
{
printf("%s",read_buffer);
}
//once done with file closig the file using file descriptor
close (file_descriptor);
}
}
return (EXIT_SUCCESS);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.