---+Fourth Lab ---++Learning Objective(s) 1. Learn the <b>for</b> loop 1. Be able nest loops 1. Be able to format output well 1. Use a switch statement 1. Learn something on your own. ---++Overview of the Program This lab involves creating an arithmetic table. You are to allow the user to specify which operation (+, -, *, /) and the size of the table. ---++Specifics ---+++Major components 1. The program should be called <b>Tables</b> 1. The user will input a letter/word indicating which operation (add, subtract, multiply, divide). But they may misspell it and/or allowed to use upper or lower case letters. So only use the first letter. 1. Use integer arithmetic for all the operations. 1. The user can specify the size of the table (up to 99) 1. The table must be nicely aligned ---+++Things to learn on your own Google can be a significant help here. Also, your textbooks can help. 1. How to get the first letter of the string 1. How to format the output with a variable amount of spaces ---+++Sample output Simplest sample result if it is an addition table for 1 - 5 is as follows. Feel free to make your table even nicer if you want. <pre> + 1 2 3 4 5 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 </pre> ---++Submission 1. Create an empty zip folder. 1. Place your program (.java file) in it 1. Place your software development report in it. 1. Submit the zip folder on canvas ---++Optional improvements 1. Add an additional operation 1. Allow for floating point in the division (outputting at most 3 digits are the decimal point) 1. Work in base 8 (doing all base work yourself). This is a MAJOR challenge and is only included for those that are extremely bored!
This topic: CenterForComputing
>
WebHome
>
SyllabiSpring2022
>
CSC121SylS2022
>
CSC121S2022Lab4
Topic revision: r1 - 2021-12-27 - cathybareiss
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback