Question

In: Computer Science

Using pseudocode, write the code that will perform the necessary file operations as described in the...

Using pseudocode, write the code that will perform the necessary file operations as described in the short scenario below:

“During registration at a college, student’s details will be captured by a staff member and written to a file called “studentDetails.dat”. The following student details will be captured: name, surname, studentNumber, registeredCourse. The staff member will be prompted for the student details. After every record added to the file, the staff member will be asked whether they would like to add another record. If they choose not to add another record, the program should end.”

Solutions

Expert Solution

Here i am providing the answer. Hope it helps. please give me a like. it helps me a lot.

Pseudocode

Main

read filename.

do

{

print prompt ”Enter student details.”

Read student details from user

Write student details to file

print prompt “whether to add another record(yes/no)”to know user choice

read user choice

}while(user choice is yes)

Endmain

Java code

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.io.FileWriter;

public class Main

{

  

   

                public static void main(String[] args) throws IOException {

                    BufferedReader reader =

                   new BufferedReader(new InputStreamReader(System.in));

        

      

       String student_details;//all student details stored in single variable

       String ch;

       FileWriter fw=new FileWriter("studentDetails.dat");

      do

      {

                    System.out.println("Enter student name,surname,studentNumber,registeredCourse");

                     student_details = reader.readLine(); // Reading data using readLine

                  

                      fw.write(student_details+"\n");    //write string details to file and move to next line

          

            System.out.println("would like to add another record(yes/no)");

            ch= reader.readLine(); //choice (yes/no) reading

             

      }while(ch.equals("yes"));//loop continue until enter no

             fw.close();

                               

                }

}

Thank you, please upvote.


Related Solutions

Using pseudocode or C++ code, write code to print “small” if the magnitude M of an...
Using pseudocode or C++ code, write code to print “small” if the magnitude M of an earthquake is in the range [0, 3), “medium” if M is in the range [3, 6), “large” if M is in the range [6, 9) and “epic” if M is greater than or equal to 9, where M is input by a user via the keyboard. (in c++)
Using a spreadsheet (such as Excel) or a calculator, perform the operations described below. Document results...
Using a spreadsheet (such as Excel) or a calculator, perform the operations described below. Document results of all intermediate modular multiplications. Determine a number of modular multiplications per each major transformation (such as encryption, decryption, primality testing, etc.). a. Test all odd numbers in the range from 223 to 229 for primality using the Miller-Rabin test with base 2. b. Encrypt the message block M= 7 using RSA with the following parameters: e = 17 and n = 223 *229....
Using pseudocode or C++ code, write a function to compute and return the product of two...
Using pseudocode or C++ code, write a function to compute and return the product of two sums. The first is the sum of the elements of the first half of an array A. The second is the sum of the elements of the second half of A. The function receives A and N ≥ 2, the size of A, as parameters. (in c++)
write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
Given the below pseudocode, write the proper code that implements it using MARIE's assembly language:               ...
Given the below pseudocode, write the proper code that implements it using MARIE's assembly language:                    Input a number and store it in X; if X > 1 then    Y := X + X;    X := 0; endif; Y := Y + 1; Output the value of Y; N.B: You should include the MARIE code in your Answer, with an explanation of each instruction in your code beside it. Example:              Subt One         /Subtract 1 from AC Add a...
Write a C Program that uses file handling operations of C language. The Program should perform...
Write a C Program that uses file handling operations of C language. The Program should perform following operations: 1. The program should accept student names and students’ assignment marks from the user. 2. Values accepted from the user should get saved in a .csv file (.csv files are “comma separated value” files, that can be opened with spreadsheet applications like MS-Excel and also with a normal text editor like Notepad). You should be able to open and view this file...
Using the code below from “LStack.h” file, write the code for a main program that takes...
Using the code below from “LStack.h” file, write the code for a main program that takes as input an arithmetic expression. The program outputs whether the expression contains matching grouping symbols. For example, the arithmetic expressions { 25 + ( 3 – 6 ) * 8 } and 7 + 8 * 2 contains matching grouping symbols. However, the expression 5 + { ( 13 + 7 ) / 8 - 2 * 9 does not contain matching grouping symbols....
//Write in C++ //use this evote code and add File I/O operations (as specified in the...
//Write in C++ //use this evote code and add File I/O operations (as specified in the comments) to it. #include<iostream> using namespace std; int main() {int choice; int bezos = 0 , gates = 0 , bugs = 0 ; int vc = 0 ; do {    cout<<"\n\n\nEVOTE\n-----"    <<"\n1.Jeff Bezos    <<"\n2.Bill Gates    <<"\n3.Bugs Bunny" // 4. Print current tally [hidden admin option] // 5. Print audit trail [hidden admin option] // 6. mess with the vote...
Using the pseudocode found below, write only the actual (C++) code for this program. Include all...
Using the pseudocode found below, write only the actual (C++) code for this program. Include all libraries. Specification: Write a program that will repeatedly ask the user for quiz grades in the range from 0 to 20. Any negative value will act as a sentinel. When the sentinel is entered compute the average of the grades entered. Design: Constants None Variables float grade float total = 0 int count = 0 float average ------- Inital Algorithm Repeatedly ask user for...
Programming Language C++ Encrypt a text file using Caesar Cipher. Perform the following operations: Read the...
Programming Language C++ Encrypt a text file using Caesar Cipher. Perform the following operations: Read the console input and create a file. ['$' character denotes end of content in file.] Close the file after creation. Now encrypt the text file using Caesar Cipher (Use key value as 5). Display the contents of the updated file. #include <iostream> using namespace std; int main() { // write code here }
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT