Question

Compute sum of the four digits in your AccessID and print it out. Please initialize your...

Compute sum of the four digits in your AccessID and print it out. Please initialize your access ID as input data by using “DC” syntax. Your output should be in this format:

My AccessID is ab1234

The sum is 10

Paste your code and screenshot of the output.

.

.

Please create a very, very simple program as I am only a beginner. You don't need to store the four digits as variables. This is what I have so far. I am getting an error and I also need the program to display the access ID that I entered in and to display the sum of the numbers stored in D1. PLEASE don't create a complicated program, just build on the one I have here.

I will rate up, again please keep it simple! Thank you!

.

*-----------------------------------------------------------

ORG $1000

START: ; first instruction of program

LEA TXT,A1

MOVE.B #14,D0

TRAP #15

  

MOVE.B #4,D0

TRAP #15

MOVE.B #1,D1

ADD.B #2,D1

ADD.B #3,D1

ADD.B #4,D1

MOVE.B #9,D0

TRAP #15

* Put variables and constants here

CR EQU $0D ; define const

LF EQU $0A ; define const

TXT DC.B 'Enter Access ID: ',CR,LF,

'My AccessID is: ',CR,LF,

'The sum is',0

END START ; last line of source

0 0
Add a comment Improve this question Transcribed image text
Answer #1

class Output

{

public static void main(String ar[])

{

int rem,res=0;

String AccessID="ab1234";

System.out.println("My AccessID is : "+AccessID);

for(int i=5;i>=2;i--)

{

String str=AccessId.charAt(i);

rem=Integer.parseInt(str);

res=res+rem;

}

System.out.println(" The sum is "+res);

}

}

Add a comment
Know the answer?
Add Answer to:
Compute sum of the four digits in your AccessID and print it out. Please initialize your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops...

    In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops for the input validations required: number of employees(cannot be less than 1) and number of days any employee missed(cannot be a negative number, 0 is valid.) Each function needs a separate flowchart. The function charts are not connected to main with flowlines. main will have the usual start and end symbols. The other three functions should indicate the parameters, if any, in start; and...

  • Please write c++ (windows) in simple way and show all the steps with the required output

    please write c++ (windows) in simple way and show all the steps with the required output Write a C++ program that simulates the operation of a simple online banking system The program starts by displaying its main menu as shown in Figure1 splay Account nformatson verity Your credit Card elect vour choice Figure 1 Main menu of the program The menu is composed of the following choices 1. When choice 1 is selected (Display Account information), the program should display...

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • Hi, I have C++ programming problem here: Problem: Please modify your string type vector in for...

    Hi, I have C++ programming problem here: Problem: Please modify your string type vector in for push_back() function as below: void push_back(string str) { // increase vector size by one // initialize the new element with str } In addition, the standard library vector doesn't provide push_front(). Implement push_front() for your vector. Test your code with the main function below. int main() {    vector v1(3);    cout<<"v1: ";    v1.print(); // this should display -, -, -    for...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • please help me out and input values please .. main cpp.. please follow intructions exactly witj...

    please help me out and input values please .. main cpp.. please follow intructions exactly witj clarity please CSE 110-Intro to Computer Programming Project #3 Requirements-String Class Functions and Test Case Documentation Using the String Class, design and develop a multi-file password validation program and Test case Document (10% of grade) that requests a password, and validates it based on the following criteria. The password must be at least 8 characters long, contain at least one number, and at least...

  • My C++ program is not compiling. Please explain how you fixed with detailed inline comments. I am using Visual Studio 2017. It's a character count program that keeps and displays a count of all th...

    My C++ program is not compiling. Please explain how you fixed with detailed inline comments. I am using Visual Studio 2017. It's a character count program that keeps and displays a count of all the upper, lower case and digits in a .txt file. The requirement is to use classes to implement it. -----------------------------------------------------------------HEADER FILE - Text.h--------------------------------------------------------------------------------------------- /* Header file contains only the class declarations and method prototypes. Comple class definitions will be in the class file.*/ #ifndef TEXT_H #define...

  • %%%%% c++ assignment %%%%%% ///////// please test your program and check for errors. //////// you should...

    %%%%% c++ assignment %%%%%% ///////// please test your program and check for errors. //////// you should use the file bellow For this assignment you will write a program that creates a tree of "plants". Each plant is the result of an exeperiment. I have provided the main driver program that is responsible for running each of the experiments but you will need to create a tree for storing the results. The objective of this assignment is to learn how to...

  • Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be...

    Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book tit le, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an...

  • Don't attempt if you can't attempt fully, i will dislike and negative comments would be given...

    Don't attempt if you can't attempt fully, i will dislike and negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book titnle, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an HTML web...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT