java program asnwer

Learning Goal: I’m working on a javascript writing question and need guidance to help me learn.

Summing Three Numbers from a File and Encryption

Implement the two programs that solve the two tasks below. Your submission should be only JAVA source files (no output screen pictures)

a) First, create a file in Notepad containing three integers separated by some whitespace. Save it as "3nums.txt" in the same folder as your code (or just download the file attached).

Then write a program that reads three integers from the file 3nums.txt and displays (on the screen) the sum of all the integers in that file.

Reading numbers from file "3nums.txt"... done.3 + 4 + 5 = 12

b) Write a program that reads from the keyboard a small password and then offers two options: 1. enter your name and a filename to save or 2. enter a file name to load.

With the option 1 proceed to save to the file an encrypted version of your name (details below), with the option 2 proceed to load the information from the file and decrypt the name and print it to the screen.

The options 1 and 2 are in reverse (1 saves the encrypted information to the file, 2 decrypts the information from the file).

Details of the encryption:

Say your name is Andrei and you chose the password 1234, then you do XOR between the ASCII code for A (first letter in your name) and the ASCII code for 1(first letter in your password), I will denote this operation (A,1)

then you do XOR between n and 2 (n,2) (second letter in your name with second letter in password) and so on, thus we will have the following operations to perform:

(A,1) (n,2) (d,3) (r,4) (e,1) (i,2).

Obviously, if you would choose the password qwer then the XOR operations will be between the following pairs:

(A,q)(n,w)(d,e)(r,r)(e,q)(i,w).

The trick is that the encrypted text can be decrypted due to the following property of XOR: A XOR B=C; C XOR B=A, thus if I have the results of the XOR operations in the file (and this is your name encrypted) then it is sufficient to do XOR with the same password (with the same ASCII codes) and I will get back the original string.

For example, with the first password, (A XOR 1) XOR 1 =A, (n XOR 2) XOR 2=n and so on:

((A,1),1) ((n,2),2) ((d,3),3) ((r,4),4) ((e,1),1) ((i,2),2)= A n d r e i.

DUE DATE March 7th, 2023 at midnight.

Please submit only the .java file(s) that solve the problem and do not forget to include your details as comments in the first few lines of the source-code as comment.

Do you need help with this paper? 🏆 - Let us help you write it!

Why Choose Our Essay Writing Service?

  • ✅ Original writing: Our expert writers will write each paper from scratch, ensuring complete originality, zero plagiarism and AI free content.
  • ✅ Expert Writers: Our seasoned professionals are ready to deliver top-quality papers tailored to your needs.
  • ✅ Guaranteed Good Grades: Impress your professors with outstanding work.
  • ✅ Fast Turnaround: Need it urgently? We've got you covered!
  • ✅ 100% Confidentiality: Customer privacy is our number one priority. Your identity is anonymous to our writers.
🎓 Why wait? Let us help you succeed! Our Writers are waiting..

Get started

Starts at $9 /page

How our paper writing service works

It's very simple!

  • Fill out the order form

    Complete the order form by providing as much information as possible, and then click the submit button.

  • Choose writer

    Select your preferred writer for the project, or let us assign the best writer for you.

  • Add funds

    Allocate funds to your wallet. You can release these funds to the writer incrementally, after each section is completed and meets your expected quality.

  • Ready

    Download the finished work. Review the paper and request free edits if needed. Optionally, rate the writer and leave a review.