In C++
Write a program that will calculate the cost of a phone call as follows:
system ("pause");
Include all Prologue information with your program
1. 9 minutes
2. 10 minutes
3. 11 minutes
4. 35 minutes
NOTE 1:
NOTE 2:
1. Declare all variables within the data declaration section of
each class and method. (-.1)
2 Do not get input on the same line as a variable
declaration. (-.1)
3. Do not place an equation for computation on the same line as
declaring a
variable. (-.1)
A) Initial Algorithm:
c) INPUT: Number of minutes used by the user
OUTPUT: The final cost for the number of minutes used in dollars.
CODE
#include <iostream>
using namespace std;
int main() {
double finalCost;
int numberOfMinutes;
cout << "Enter the number of minutes used: ";
cin >> numberOfMinutes;
if (numberOfMinutes == 0) {
cout << "No minutes were entered." << endl;
} else {
if (numberOfMinutes <= 10) {
finalCost = 0.99;
} else {
finalCost = 0.99 + (numberOfMinutes - 10) * 0.1;
}
printf("The final cost is: $%.2f", finalCost);
}
system("pause");
return 0;
}
NOTE: Please explain what should go inside refined algorithm. Since I am not sure of what to include inside it, I have skipped it.
In C++ Write a program that will calculate the cost of a phone call as follows:...
WRITE THIS PROGRAM IN JAVA CODING ONLY ! Program 1: In Order Using an IF/ELSE IF/ELSE structure, write a program that will prompt the user for three numbers and displays them in ascending order. First, the program will prompt the user for each of the three numbers. Next, find the smallest value of the three. Then decide which of the other two is the next smallest. Then have the program display the three numbers in ascending order. Be sure to...
import java.util.*; /** Description: This program determines the average of a list of (nonnegative) exam scores. Repeats for more exams until the user says to stop. Input: Numbers, sum, answer Output: Displays program description Displays instruction for user Displays average Algorithm: 1. START 2. Declare variables sum, numberOf Students, nextNumber, answer 3. Display welcome message and program description 4. DOWHILE user wants to continue 5. Display instructions on how to use the program 6. Inititalize sum and number of student...
PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file timeValidation.txt : ...
Question2 uses structured design implemented in C. Array of records (structs) with file I/O is needed. The program takes two inputs at a time. The name of a person, and, the coin value as an integer in the range 5 to 95. Input coin values should always be divisible by 5 (integer division). Names are one word strings. An example input is: Jane 30 This input line indicates that 30 cents change is to be given to Jane. Output change...
Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...
In Java Code Needed is Below the Question Using Program 3: Encapsulating Dogs, modify this program to create a database of dogs of your own. You will also include File I/O with this program. You will create 3 classes for this assignment. The first class: Create a Class representing the information that is associated with one item (one dog) of your database. Name this class Dog. Using Lab 3, this will include the information in regard to one dog. The...
C Language Programming. Using the program below - When executing on the command line only this program name, the program will accept keyboard input and display such until the user does control+break to exit the program. The new code should within only this case situation “if (argc == 1){ /* no args; copy standard input */” Replace line #20 “filecopy(stdin, stdout);” with new code. Open read a text file “7NoInputFileResponse.txt” that contains a message “There were no arguments on the...
a C++ program that computes the cost of a long-distance call. The cost of the call is determined according to the following rate schedule: a. Any call started between 8:00 A.M. and 6:00 P.M., Monday through Friday, is billed at a rate of $0.40 per minute. b. Any call starting before 8:00 A.M. or after 6:00 P.M., Monday through Friday, is charged at a rate of $0.25 per minute. c. Any call started on a Saturday or Sunday is charged...
implicit none ! Declare File Read Variables CHARACTER(255) :: Line INTEGER :: CP ! Character position in Line INTEGER :: File_Read_Status ! Declare character constants CHARACTER :: Tab > ACHAR(1) CHARACTER :: Space = " " ! Read all lines in the file DO READ(*,'(A)',iostat = File_Read_Status) Line ! Exit if end of file IF (File_Read_Status < 0) EXIT ! Skip leading white space DO CP = 1, LEN_TRIM(Line) IF...
Use Java Please File 1 and File 2 at bottom of post. 1. Write a program that compares two text files for equality. Print out any lines that are different along with the line number. 2. Include the following: File I/O Exception Handling using a Try/Catch Block Algorithm: Initial and Refined Internal Documentation All prologue information The two external files 3. Use the following two files: File1.txt and File2.txt. These files are included. I have also attached zip files containing...