Design a console application that will print the cell phone bill of a customer. Make use of an abstract class named Cell that contains variables to store the customer name, talk time and price per minute. Create a constructor that accepts the customer name, talk time and price per minute as parameters, and create get methods for the variables. The Cell class must implement an iPrintable interface that contains the following:
public interface iPrintable
{
public void print_bill();
}
Create a subclass called Cell_Billing that extends the Cell class. The Cell_Billing class must contain a constructor to accept the customer name, talk time and price per minute as parameters. Write code for the print_bill method which calculates the total due (talk time * price per minute). Finally write a useCell class to instantiate the Cell_Billing class. Sample output is shown below and you may use the same values to test your application
Redraw the flowchart of the cellphone so that it uses the following methods to calculate the billing amount. (do not output the number of minutes during which the service is used.)
a. regularBill: This method calculates and returns the billing amount for regular
service.
b. premiumBill: This method calculates and returns the billing amount for premium
service.
.Write a program to find the sum of all the prime numbers in the range n to m. Display each prime number and the final sum. using java
.Write a program to find the sum of all the prime numbers in the range n to m. Display each prime number and the final sum.
// build and run this example #include #include #include int main(void) { BOOL bRet; STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si,sizeof(si)); si.cb=sizeof(si); ZeroMemory(&pi,sizeof(pi)); bRet=CreateProcess(NULL,"notepad.exe",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); if(bRet==FALSE) { printf("Error: %u\n",GetLastError()); return 1; } CloseHandle(pi.hProcess); CloseHandle(pi.hThread); // close handles to kernel objs return 0; }
// build and run this example #include #include #include void _tmain( int argc, TCHAR *argv[] ) { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); if( argc != 2 ) { printf("Usage: %s [cmdline]\n", argv[0]); return; } // Start the child process. if( !CreateProcess( NULL, // No module name (use command line) argv[1], // Command line NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE 0, // No creation flags NULL, // Use parent's environment block NULL, // Use parent's starting directory &si, // Pointer to STARTUPINFO structure &pi ) // Pointer to PROCESS_INFORMATION structure ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); return; } // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); }
1.Write and build your C program which creates a txt file and write into your name and your number 10 times. (You can use FileIO.pdf samples or you can write it on your own ). 2. And use yourprogram.exe file in another process in createProcess method as parameter. Example: bRet=CreateProcess(NULL,"yourprogram.exe",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); 3. Finally you should submit two C file 1 yourprogram.c (which creates a txt and write into your name and your number 10 times.) 2 mainprogram.c
Develop an application in Java for automating the Banking Operations using interfaces.
Create an interface called “Transaction” which contains the functions such as deposit,
withdraw, and viewBalance. Create another interface called “Displayable” which
contains the Display () function to display the account details.
Create an abstract class called “Account” with bank account details such as acc_name,
acc_no, and balance. Add necessary constructors.
Create a “Bank” class which implements the “Transaction”, “Displayable” interfaces
and inherits “Account” class.
Perform menu driven operations like Deposit, Withdraw and Balance Enquiry, View
Account Details from a Main class. Write logics in the corresponding methods.
Explain the following variables with example
1, static variable
2, object variable
3, instance variable