Concept explainers
What output will be sent to the stuff.dat when the following lines are executed (assuming the lines are embedded in a complete and correct
ofstream fout;
fout.open(“stuff.dat”) ;
fout << “*” << setw(5) << 123 << “*”
<< 123 << “*” <<endl;
fout.setf(ios::showpos);
fout << “*” << setw(5) << 123 << “*”
<< 123 <<“*”<<endl;
fout.unsetf(ios::showpos);
fout.setf(ios::left);
fout << “*” << setw(5) << 123 << “*”
<< setw(5) << 123 << “*” <<endl;
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Python (3rd Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Software Engineering (10th Edition)
Database Concepts (8th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- In this assignment, you will create a Java program to read undergraduate and graduate students from an input file, sort them, and write them to an output file. This assignment is a follow up of assignment 5. Like assignment 5, your program will read from an input file and write to an output file. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. Unlike assignment 5, the Student objects are sorted before they are written to the output file. • The program must implement a main class, three student classes (Student, UndergradStudent, GradStudent), and a Comparator class called StudentIDComparator. • The StudentIDComparator class must implement the java.util.Comparator interface, and override the compare() method. Since the Comparator interface is a generic interface, you must specify Student as the type parameter when defining the StudentIDComparator class, i.e., public class StudentIDComparator implements…arrow_forwardUse the Bash shell for the completion of this project. Develop a shell scripting application that allows the user to perform some advanced mathematical operations. Your application should allow the user to perform these tasks: Task 2: Find the term of any linear sequence given by the rule Term = a * n + b, where a and b are integers specified by the user and n is a positive integer and print them in order (for example if the user inputs a=3, b=-4, the first few terms that should be printed are -1, 2, 5, 8, 11…). The user also will specify how many terms the program should print. In addition, the program should print the sum of terms found and a count of how many odd terms were found.arrow_forward12. John is used to doing programming in Python and since the print() function in Python by default prints a newline after printing the string passed to the print() function. But in his current project, he is using PHP programming language and the echo function does not print a newline by default after the end of the string. So, he often misses giving a newline after printing a message. Help David by writing a function myecho() that takes a string as a parameter and also prints a newline after printing the string.arrow_forward
- Write a program that computes the tax and tip on a restaurant bill for a patron with a$44.50 meal charge. The tax should be 6.75 percent of the meal cost. The tip should be15 percent of the total after adding the tax. Display the meal cost, tax amount, tip amount,and total bill on the screen. Use the template, Program1-Template.cpp, to complete thisprogramming assignment. Download the attached file, Program1-template.cpp, from Blackboard and rename it asProgram1.cpp. Any line that starts with the characters "//" is a comment in C++ and thecompiler ignores it. Remove the angle brackets "<" and ">" in any line that starts with "//"and replace it with the appropriate information.arrow_forwardWrite a function that returns the result of the following expression: (x² + y²) / z² It should throw an error message string if division by zero occurs. Write a main () that prompts the user for three integers, then passes those three integers (in order) to the function you wrote for assignment 1. Make sure you have an exception handler. Belt-and-suspenders time! Update main () so that it also checks the values input by the user to ensure that division by zero doesn't occur and the user is prompted repeatedly until they enter legal values.arrow_forward] Write a program email.cc that takes an email address in the following format: firstname.lastname@uleth.ca, such as jon.doe@uleth.ca, extractsfrom it the firstname and the lastname, and prints them in the following format: Lastname,Firstname. Your program should have and use at least the following functions:(a) getEmaillAddress that prompts a user to enter an email address as a string andreturns it.(b) extract that takes as its parameter an email address and returns the firstname andlastname.(c) capitalize that takes as its parameter a string and capitalize its first letter.(d) display that takes as its parameters 2 strings corresponding to the firstname andlastname, and displays them in the following format: Lastname, Firstname.Your program should repeatedly prompts the user to enter the email address in the previous format. The program should then output it as in the examples below.arrow_forward
- Consider a CSV file contains information about COVID-19 status of Bangladesh. The header of this file is "Date", "District", "Effected Today", and "Recover Today". Write a java program to find the minimum of the "Effected Today" and the maximum of "Recover Today" column from the file. Example: File contains: Output: Effected Today: 27 Recover Today: 195 18/6/2021, DHK, 345, 195 18/6/2021, BOG, 75, 28 18/6/2021, CHT, 231, 68 18/6/2021, KHL, 27, 17arrow_forwardHi, I have posted this question before but the solution am getting is not what I want. Note: Please follow the instructions I posted before the question, let me know if there is an issue. Instruction: Please write these problems in javascript. 1. You are to have two javascript files: a. your problem javascript and b. your test javascript file that verifies the function that was written in your problem javascript 2. The implementation for your 5 JavaScript functions must be completed within your - problems.js file. 3. Your Problem JavaScript functions file must be configured for strict mode (“use strict”) The pages that follow provide the description of the 5 JavaScript functions that you must implement Questions 1. Description a). You are to develop a JavaScript file (problems.js) that contains the implementation of 5functions. Each function is represented as one step, b). Each function is independent and solves a unique problem, as such, treat and implement each function in…arrow_forwardHi, I have posted this question before but the solution am getting is not what I want. Note: Please follow the instructions I posted before the question, let me know if there is an issue. Instruction: Please write these problems in javascript. 1. You are to have two javascript files: a. your problem javascript and b. your test javascript file that verifies the function that was written in your problem javascript 2. The implementation for your 5 JavaScript functions must be completed within your - problems.js file. 3. Your Problem JavaScript functions file must be configured for strict mode (“use strict”) The pages that follow provide the description of the 5 JavaScript functions that you must implement Questions 1. Description a). You are to develop a JavaScript file (problems.js) that contains the implementation of 5functions. Each function is represented as one step, b). Each function is independent and solves a unique problem, as such, treat and implement each function in…arrow_forward
- Hi, I have posted this question before but the solution am getting is not what I want. Note: Please follow the instructions I posted before the question, let me know if there is an issue. Instruction: Please write these problems in javascript. 1. You are to have two javascript files: a. your problem javascript and b. your test javascript file that verifies the function that was written in your problem javascript 2. The implementation for your 5 JavaScript functions must be completed within your - problems.js file. 3. Your Problem JavaScript functions file must be configured for strict mode (“use strict”) The pages that follow provide the description of the 5 JavaScript functions that you must implement Questions 1. Description a). You are to develop a JavaScript file (problems.js) that contains the implementation of 5functions. Each function is represented as one step, b). Each function is independent and solves a unique problem, as such, treat and implement each function in…arrow_forwardComputer Science In a file named Exercise2.c write the function double sum(double (*f)(double), int start, int end); The call sum(g,i,j) should return g(i)+…+g(j). Add a main function to illustrate the use of your implementation of sum applied to sqrt from 1 to 10.arrow_forwardWrite a parallel version of the program below using MPI. The output should be essentially the same as the sequential version; the only exception is that the perfect numbers might be found in a different order. Your program should report the total number of perfect numbers found and the time, exactly as the sequential version does. #include <stdio.h> #include <stdlib.h> #include <sys/time.h> double mytime() { struct timeval t; gettimeofday(&t, NULL); return t.tv_sec + t.tv_usec/1000000.0; } _Bool is_perfect(int n) { if (n < 2) return 0; int sum = 1, i = 2; while (1) { const int i_squared = i*i; if (i_squared < n) { if (n%i == 0) sum += i + n/i; i++; } else { if (i_squared == n) sum += i; break; } } return sum == n; } int main(int argc, char * argv[]) { int num_perfect = 0; double start_time = mytime(); if (argc != 2) { printf("Usage: perfect.exec bound\n"); exit(1); } int bound = atoi(argv[1]); for (int i=1; i<=bound; i++) { if (i%1000000 ==…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education