Python Programming- Practice Lists & Tuples B
#This is a template for practicing mutability and
conversion
#Create and assign the following list of numbers to a list data
type and variable name: 99.9,88.7,89,90,100
#convert the list to a tuple and assign the tuple a different
variable name
#Ask the user for a grade and convert it to a float type (no
prompt) and assign it to a new variable name
#append the user entered grade to the list
#update the tuple to reflect the user entered grade (Tip, replace
the entire tuple with the list converted to a tuple)
#compute the current average grade using the tuple
#Display the average that you calculated in the previous line using
the following format:
#Your current grade is: [calculated average}. (Tip: use the +
concatenator and convert the average to a string)
#Ask the user for another grade (no prompt), convert it to an
integer and assign it to a new variable name
#replace the fourth grade in the list with the most recently
entered grade (Tip, you'll need to use the index)
#remove the fifth grade from the list (Tip, you'll need to use the
index and the pop method)
#update the tuple to reflect these recent changes to the list (Tip:
replace the entire tuple with the converted list)
#compute the current average grade using the tuple (Tip: divide the
tuple sum by the tuple length)
#Display the latest average that you calculated in the previous
line using the following format:
#Your updated grade is: [calculated average}. (Tip: use the +
concatenator and convert the average to a string)
#Display the following statement using the + concatenator using the
latest values for sum, length and average:
#(Tip: make sure all the three variables have been converted to
strings)
#With a sum of [sum of tuple] for [length of tuple] assignments
your grade is [tuple average]!
In: Computer Science
PYTHON
Computer Science
Objectives
Work with lists Work with functions Work with files
Assignment
Write each of the following functions. The function header must be
implemented exactly as specified. Write a main function that tests
each of your functions.
Specifics
In the main function ask for a filename and fill a list with the values from the file. Each file should have one numeric value per line. This has been done numerous times in class. You can create the data file using a text editor or the example given in class – do not create this file in this program. Then call each of the required functions and then display the results returned from the functions. Remember that the functions themselves will not display any output, they will return values that can then be written to the screen.
If there are built in functions in Python that will accomplish the tasks lists below YOU CANNOT USE THEM. The purpose of this lab is to get practice working with lists, not to get practice searching for methods. DO NOT sort the list, that changes the order of the items. The order of the values in the list should be the same as the order of the values in the file.
Required Functions
def findMaxValue (theList) – Return the largest integer value found in the list. def findMinValue (theList) – Return the smallest integer value found in the list.
int calcRange (theList) – Return the range of values found in the list. The range is the difference between the largest and smallest values. This function MUST USE findMaxValue and findMinValue to determine the value to return. This function CANNOT have its own loop.
def calcAverage (theList) – Return the average of all the values found in the list.
def findNumberAbove (theList, testValue) - Return the number of values greater than OR equal to the second argument (testValue).
def findFirstOccurance (theList, valueToFind) – Return the index of the first occurrence of valueToFind. If valueToFind does not exist in the list return -1.
def findLastOccurance (theList, valueToFind) – Return the index of the last occurrence of valueToFind. If valueToFind does not exist in the list return -1.
def calcCount (theList, valueToFind) – Return the number of occurrences of valueToFind within the list.
def isInList (theList, valueToFind) – Return True if valueToFind occurs at least once in the list, otherwise return False.
In: Computer Science
Javascript array of objects: I'm trying to get the input into an array of objects, and then display the information in a table using a for loop, but I don't think my path is right
<!DOCTYPE html>
<head>
<title>Form</title>
<meta charset="utf-8" />
<style media="screen">
h1 {
text-align: center;
}
div {
background-color: #pink;
border: 2px solid green;
padding: 15px;
margin: 65px;
}
</style>
<script>
var list = [];
total = 0;
text = "";
function Product(item, quantity, costs){
this.item = item;
this.quantity = quantity;
this.cost = cost;
}
function insert() {
list.push(new
Product(document.getElementById('productItem').value,
document.getElementById('productQuantity').value),
document.getElementById('productCost').value);
var table="<table ><tr><th>Item</th><th>Cost</th><th>Quantity</th></tr>";
for(var i=0;i<list.length;i++)
{
table+="<tr><td>"+list[i].item+"</td><td>"+list[i].cost+"</td><td>"+list[i].quantity+"</td><td>"+list[i].cost*list[i].quantity+"</td></tr>";
}
table+="</table>";
document.getElementById("demo1").innerHTML =table;
}
function displayReceipt() {
total = 0;
text = "";
text = "==============================================";
text += "<br /><h2>your order</h2>";
text +=
"<table><tr><th>Item</th><th>Cost</th><th>Quantity</th><th>Total</th></tr>";
for (var i = 0; i < list.length; i++) {
total+=list[i].cost*list[i].quantity;
text +=
"<tr><td>"+list[i].item+"</td><td>"+list[i].cost+"</td><td>"+list[i].quantity+"</td><td>"+list[i].cost*list[i].quantity+"</td></tr>";
}
text+="<tr><th colspan=3>Total Cost
</th><th>"+total.toFixed(2)+"</th></tr>";
text += "</table>";
document.getElementById("demo2").innerHTML = text;
}
function checkout() {
displayReceipt();
}
</script>
</head>
<body>
<div>
<h1>market</h1>
<
<form>
Item: <input id="item" name="productItem" type="text"
placeholder="Item"><br><br>
Cost: <input id="productCost" name="productCost" type="number"
placeholder="Cost"><br><br>
Quantity: <input id="productQuantity" name="productQuantity"
type="number" size="20"
placeholder="Quantity"><br><br><br>
<input type="reset" value="Add to Cart"
onclick="insert()">
<input type="button" value="Checkout"
onclick="checkout()">
</form>
<p id="demo1"></p>
<p id="demo2"></p>
<p id="demo3"></p>
</div>
</body>
</html>
In: Computer Science
The application has class Magazine which describes one Magazine object. Class LLMagazineRec desribes linked list whose nodes have data of Magazine type and includes recursive method createArrayListRec which you have to implement. Class Driver has main method that creates myList as linked lists of magazines. It should invoke recursive method from class LLMagazineRec. WRITTEN IN JAVA
1.)code for magazine class:
// Class Magazine describes magazine object that has title and
number of pages
public class Magazine
{
private int pages; //number of pages
private String name; // magazine name or title
public Magazine(int p, String n)
{
pages = p;
name = n;
}
public int getPages()
{
return pages;
}
public String getName()
{
return name;
}
public String toString()
{
return name + "\t" + pages;
}
}
2.) code for llmagazierec class:
import java.util.*;
/* Class LLMagazineRec defines linked list of magazine objects. It
includes
* recursive methods to print all magazines, to calculate sum pages
in all
* magazines, and to find longest magazine in linked list.
*/
public class LLMagazineRec
{
private Node list;
public LLMagazineRec()
{
list = null;
}
public Node getList()
{
return list;
}
public void addRear(Magazine mag)
{
Node node = new Node(mag);
if (list == null)
list = node;
else
{
Node curr = list;
while (curr.next!= null)
curr= curr.next;
curr.next = node;
}
}
// Returns ArrayList<Magazine> storing all Magazine objects
from the linked
// list. Method accepts reference to the beginning of the linked
list. It
// must be RECURSIVE, and should work for EMPTY and for NON-EMPTY
list.
public ArrayList<Magazine> createArrayListRec(Node
first)
{
//INSERT CODE HERE
}
private class Node
{
public Magazine data;
public Node next;
public Node(Magazine mag)
{
data = mag;
next = null;
}
public String toString()
{
return data.toString();
}
}
}//End LLMagazineRec
3.) code for Driver class:
/**
* Class Driver tests methods from LLMagazineRec class.
*/
public class Driver
{
public static void main(String[] args)
{
System.out.println("Creating linked list myList");
LLMagazineRec myList = new LLMagazineRec();
myList.addRear(new Magazine(35, "Golf Digest"));
myList.addRear(new Magazine(49, "Sports Illustrated"));
myList.addRear(new Magazine(101, "Time"));
myList.addRear(new Magazine(130, "Vogue"));
System.out.println("\nPrinting resulting ArrayList");
//INSERT CODE TO INVOKE THE METHOD createArrayListRec
//AND PRINT ITS RESULT BY USING FOR EACH LOOP
}
}
In: Computer Science
code in. c++
void seen );
If there is already a Word object in the Words list, then the
number of occurrences for this word is incremented. If there is no
Word object for this word already, create a new word object with
occurrence =1, and insert this object into the list of Word
objects.
getNextWord();
Returns the next word of the list and sets the currentItem pointer
to the next Word. This may return an empty string, “”, if the
pointer is NULL.
StackNode* findWord(std::string);
Returns a pointer to some Word in the list. Return NULL if not
found.
Write a driver to do the following:
Create a Words object. This is a linked list of Word objects.
Open an input file full of mixed words. Read each word. For each word in the input file, call the seen method for this word. The seen method takes a string argument. For example, the word ‘cat’ was just read in. Call myWords.seen(“cat”).
After processing all of the words in the file, close the file.
Last, print out the statistics of the file to the console.
Include:
For every word in the Words object, print the word and the number
of occurrences. The total number of Words in the file.
complete
#ifndef WORD_H_
#define WORD_H_
#include <string>;
class Word
{
private:
std::string word;
int occurrences;
public:
Word(std::string w); //word = w and occurrences = 1
std::string getWord() const; //return the stored word
int getOccurrences() const;
void increment(); //increment the occurrences value
};
#endif
complete
#ifndef WORDS_H_
#define WORDS_H_
#include <string>;
#include "Word.h";
class Words
{
private:
struct StackNode
{
Word word;
StackNode *next;
};
StackNode *top;
StackNode *currentItem;
StackNode* findWord(std::string); //Returns a pointer to some Word in the list
// return NULL if not found
public:
Words() // Create an empty list of Word objects
{ top = NULL;
resetNextWord();
}
void remove(std::string); //remove a word object, if it is in the list
bool find(std::string) const; //if the word, as a string, is in the list, return true. else false
void seen(std::string); //pass in a word, as a string, that has been seen.
// If this word is not in the list, insert it with
// the number of occurrences = 1.
// If this word is in the list, increment the
// occurrences for this word.
int getOccurrences(std::string) const; //return the value of occurrences
int getLength() const; // returns the length of the list. NOT STORED
std::string getNextWord(); // returns the next word of the list and sets
// the currentItem pointer to the next Word
void resetNextWord(); //resets the currentItem pointer to top.
bool isEmpty() const;
};
#endifIn: Computer Science
class SLinkedList:
"""Singly linked list with access to front and end, and with stored
size.
"""
#-------------------------- nested _Node class
--------------------------
class _Node:
__slots__ = '_element', '_next' # streamline memory usage
def __init__(self, element, next):
self._element = element
self._next = next
#------------------------------- queue methods
-------------------------------
def __init__(self):
"""Create an empty list."""
self._head = None
self._tail = None
self._size = 0
def __len__(self):
"""Return the number of elements in the list."""
return self._size
def isEmpty(self):
"""Return True if the list is empty."""
return self._size == 0
# READ THIS!
def __repr__(self):
plist = []
current = self._head
# This is how to traverse a list:
while current != None: # use a while-loop.
plist.append(current._element) # process the stored element.
current = current._next # jump to the next node.
return "SLinkedList(%s)" % repr(plist)
def first(self):
"""Return but do not remove the first element.
Raise EmptyError if the list is empty.
"""
if self.isEmpty():
raise EmptyError('The SLinkedList is empty')
return self._head._element
def deleteFirst(self):
"""Remove and return the first element.
Raise EmptyError if the list is empty.
"""
if self.isEmpty():
raise EmptyError('The SLinkedList is empty')
answer = self._head._element
self._head = self._head._next
self._size -= 1
if self.isEmpty(): # special case when list is empty
self._tail = None # removed head had been the tail
return answer
def addFirst(self, e):
"""Add element e to the front of the list."""
self._head = self._Node(e, self._head) # create and link a new
node
if self._tail == None: # special case when list was empty
self._tail = self._head # added head is the tail
self._size += 1
def addLast(self, e):
"""Add e to the end of the list."""
newest = self._Node(e, None) # node will be new tail node
if self.isEmpty():
self._head = newest # special case: previously empty
else:
self._tail._next = newest
self._tail = newest # update reference to tail node
self._size += 1
def last(self):
"""Return but do not remove the last element.
Raise EmptyError if the list is empty.
"""
if self.isEmpty():
raise EmptyError('The SLinkedList is empty')
return self._tail._element
def _nodeAtIndex(self, index):
"""Returns the reference to the node at the given index;
If index is out of range, raise IndexError
"""
# PROBLEM 2
# You can assume that index is non-negative.
# You need to traverse the list and stop at the required
index.
# YOUR CODE HERE
raise NotImplementedError()
def __getitem__(self, index):
aNode = self._nodeAtIndex(index)
return aNode._element
def __setitem__(self, index, value):
# PROBLEM 3
# YOUR CODE HERE
raise NotImplementedError()
def deleteLast(self):
"""Remove and return the last element. Runs in O(n) time.
Raise EmptyError if the list is empty.
"""
# PROBLEM 4
# Your code should handle three cases:
# a list of size 0, size 1 and size >=2.
# If the list is of size >= 2
# you need to traverse the list and stop at the second last
node;
# that node contains a reference to the last node;
# this reference needs to be copied/assigned to self._tail
# YOUR CODE HERE
In: Computer Science
Please provide a detailed walk through osf this Java application, which uses recursion to find the maximal (largest) contiguous sum in a list of integers. Base code on the algorithm below.
Input Read from a text file (List.dat) lines of data where each line represents a list in this format:
list-size numbers in the list separated by blanks 4 100 -50 5 8
For example, List.dat might contain: 7 -2 -4 30 15 -7 -5 1000 2 -50 100 6 1000 -2000 900 2800 -2900 2801 0 4 100 -10 5 8 4 100 -50 5 8
Note: the list-size must be greater than 0. Bypass any line with 0 or a negative number as the first number, i.e., NO empty list. No error checking needed. You may assume that your input file is structured correctly: it contains all integers, and if the first number on a line is n, then there are n integers that follow it on that line.
Output For each line of data read, display the largest sum of consecutive integers in the list followed by the list itself. For the example lists as above, your output would be:
Largest sum of The list used consecutive integers 1033 -2 -4 30 15 -7 -5 1000 100 -50 100 3700 1000 -2000 900 2800 -2900 2801 103 100 -10 5 8 100 100 -50 5 8
Algorithm - processing
• Use a loop to read each line of data from List.dat until end-of-file is reached
• On each pass of the loop implement an array of list-size (1st number on the line) to hold the list of numbers read (from the rest of the line)
• Invoke a recursive method (or a surrogate/helper method that invokes a recursive method— more on this below) that returns the largest contiguous sum for this list
• Display the sum and the list (as above) • Do not use any "global" variables in your code (your methods should use only parameters or local variables, no static variables that recursive methods would refer to, as they would not be instantiated)
Input File Include a file of test data in your src folder. The contents of your file will be replaced with my test data. Recall you can access this file in your program with this code:
Scanner fileScan = new Scanner (new File("src\\List.dat"));
You can recall in CSC 135 we read from a file that contained URLs.
Using Recursion Your main method should call this helper method, which returns the maximum contiguous sum on the list aList:
//This method returns the maximum contiguous sum public static int maxSum(int[] aList)
but in order to use recursion we need more parameters, so the method above maxSum will simply serve as a surrogate which calls another method, the recursive method, which does all the work:
//This method returns the maximum contiguous sum from a list stored in an //array which begins at cell "start" and ends at cell "end" public static int maxContigSum (int[] aList, int start, int end)
Using the approach for developing a recursive solution:
• Base case: a list with 1 item. What will the maximum sum be? • Assume we can determine the maximum sum for a list of contiguous items in a shorter list. (Looking ahead: the shorter list that we'll use in the next step, the general case, will be the list beginning at cell "start+1" and ending at cell "end (you could also do "start" till "end-1"). We'll remember that sum as it will be a candidate for the maximum sum that our method should return. • General case: From our assumption we know what the maximum contiguous sum is for all cells excluding the first cell, so now we need to consider any sum, which contains the first cell. So now compute (use a loop, not recursion here) all possible sums from your list that include the first cell. As you compute these sums compare them to your maximum sum so far (which initially will be what was returned by your assumption above)
In: Computer Science
Objective: Manipulate the Linked List Pointer.
_____________________________________________________________________________________________________________________________________________________
/** Source code example for "A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** List ADT */
public interface List {
/** Remove all contents from the list, so it is once again
empty. Client is responsible for reclaiming storage
used by the list elements. */
public void clear();
/** Insert an element at the current location. The client
must ensure that the list's capacity is not exceeded.
@param item The element to be inserted. */
public void insert(E item);
/** Append an element at the end of the list. The client
must ensure that the list's capacity is not exceeded.
@param item The element to be appended. */
public void append(E item);
/** Remove and return the current element.
@return The element that was removed. */
public E remove();
/** Set the current position to the start of the list */
public void moveToStart();
/** Set the current position to the end of the list */
public void moveToEnd();
/** Move the current position one step left. No change
if already at beginning. */
public void prev();
/** Move the current position one step right. No change
if already at end. */
public void next();
/** @return The number of elements in the list. */
public int length();
/** @return The position of the current element. */
public int currPos();
/** Set current position.
@param pos The position to make current. */
public void moveToPos(int pos);
/** @return The current element. */
public E getValue();
}
/** Source code example for "A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
// Doubly linked list implementation
class LList implements List {
protected DLink head; // Pointer to list header
protected DLink tail; // Pointer to last element in list
protected DLink curr; // Pointer ahead of current element
int cnt; // Size of list
//Constructors
LList(int size) { this(); } // Ignore size
LList() {
curr = head = new DLink(null, null); // Create header node
tail = new DLink(head, null);
head.setNext(tail);
cnt = 0;
}
public void clear() { // Remove all elements from list
head.setNext(null); // Drop access to rest of links
curr = head = new DLink(null, null); // Create header node
tail = new DLink(head, null);
head.setNext(tail);
cnt = 0;
}
public void moveToStart() // Set curr at list start
{ curr = head; }
public void moveToEnd() // Set curr at list end
{ curr = tail.prev(); }
/** Insert "it" at current position */
public void insert(E it) {
curr.setNext(new DLink(it, curr, curr.next()));
curr.next().next().setPrev(curr.next());
cnt++;
}
/** Append "it" to list */
public void append(E it) {
tail.setPrev(new DLink(it, tail.prev(), tail));
tail.prev().prev().setNext(tail.prev());
cnt++;
}
/** Remove and return current element */
public E remove() {
if (curr.next() == tail) return null; // Nothing to remove
E it = curr.next().element(); // Remember value
curr.next().next().setPrev(curr);
curr.setNext(curr.next().next()); // Remove from list
cnt--; // Decrement the count
return it; // Return value removed
}
/** Move curr one step left; no change if at front */
public void prev() {
if (curr != head) // Can't back up from list head
curr = curr.prev();
}
// Move curr one step right; no change if at end
public void next()
{ if (curr != tail.prev()) curr = curr.next(); }
public int length() { return cnt; }
// Return the position of the current element
public int currPos() {
DLink temp = head;
int i;
for (i=0; curr != temp; i++)
temp = temp.next();
return i;
}
// Move down list to "pos" position
public void moveToPos(int pos) {
assert (pos>=0) && (pos<=cnt) : "Position out of range";
curr = head;
for(int i=0; i
}
public E getValue() { // Return current element
if (curr.next() == tail) return null;
return curr.next().element();
}
// Extra stuff not printed in the book.
/**
* Generate a human-readable representation of this list's contents
* that looks something like this: < 1 2 3 | 4 5 6 >. The vertical
* bar represents the current location of the fence. This method
* uses toString() on the individual elements.
* @return The string representation of this list
*/
public String toString()
{
// Save the current position of the list
int oldPos = currPos();
int length = length();
StringBuffer out = new StringBuffer((length() + 1) * 4);
moveToStart();
out.append("< ");
for (int i = 0; i < oldPos; i++) {
out.append(getValue());
out.append(" ");
next();
}
out.append("| ");
for (int i = oldPos; i < length; i++) {
out.append(getValue());
out.append(" ");
next();
}
out.append(">");
moveToPos(oldPos); // Reset the fence to its original position
return out.toString();
}
}
/** Source code example for "A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** Doubly linked list node */
class DLink {
private E element; // Value for this node
private DLink next; // Pointer to next node in list
private DLink prev; // Pointer to previous node
/** Constructors */
DLink(E it, DLink p, DLink n)
{ element = it; prev = p; next = n; }
DLink(DLink p, DLink n) { prev = p; next = n; }
/** Get and set methods for the data members */
DLink next() { return next; }
DLink setNext(DLink nextval)
{ return next = nextval; }
DLink prev() { return prev; }
DLink setPrev(DLink prevval)
{ return prev = prevval; }
E element() { return element; }
E setElement(E it) { return element = it; }
}
public class GameEntry {
protected String name;
protected int score;
public GameEntry(String n, int s) {
name = n;
score = s;
}
public String getName() {return name;}
public int getScore() {return score;}
public String toString() {
return "("+name+","+score+")";
}
}
//gamescore.txt
Mike,1105
Rob,750
Paul,720
Anna,660
Rose,590
Jack,510
In: Computer Science
Note: This problem is for the 2018 tax year.
Lance H. and Wanda B. Dean are married and live at 431 Yucca Drive, Santa Fe, NM 87501. Lance works for the convention bureau of the local Chamber of Commerce, while Wanda is employed part-time as a paralegal for a law firm.
During 2018, the Deans had the following receipts:
|
Wanda was previously married to John Allen. When they divorced several years ago, Wanda was awarded custody of their two children, Penny and Kyle. (Note: Wanda has never issued a Form 8332 waiver.) Under the divorce decree, John was obligated to pay alimony and child support—the alimony payments were to terminate if Wanda remarried.
In July, while going to lunch in downtown Santa Fe, Wanda was injured by a tour bus. As the driver was clearly at fault, the owner of the bus, Roadrunner Touring Company, paid her medical expenses (including a one-week stay in a hospital). To avoid a lawsuit, Roadrunner also transferred $90,000 to her in settlement of the personal injuries she sustained.
The Deans had the following expenditures for 2018:
|
The life insurance policy was taken out by Lance several years ago and designates Wanda as the beneficiary. As a part-time employee, Wanda is excluded from coverage under her employer's pension plan. Consequently, she provides for her own retirement with a traditional IRA obtained at a local trust company. Because the mayor is a member of the local Chamber of Commerce, Lance felt compelled to make the political contribution.
The Deans' household includes the following, for whom they provide more than half of the support:
|
Penny graduated from high school on May 9, 2018, and is undecided about college. During 2018, she earned $8,500 (placed in a savings account) playing a harp in the lobby of a local hotel. Wayne is Wanda's widower father who died on January 20, 2018. For the past few years, Wayne qualified as a dependent of the Deans.
Federal income tax withheld is $4,200 (Lance) and $2,100 (Wanda). The proper amount of Social Security and Medicare tax was withheld.
Required:
Determine the Federal income tax for 2018 for the Deans on a joint return by providing the following information that would appear on Form 1040 and Schedule A. They do not want to contribute to the Presidential Election Campaign Fund. All members of the family had health care coverage for all of 2018. If an overpayment results, it is to be refunded to them.
2. Calculate taxable gross income.
3. Calculate the total adjustments for AGI.
4. Calculate adjusted gross income.
5. Calculate the greater of the standard deduction or itemized deductions.
6. Calculate total taxable income.
7. Calculate the income tax liability.
8. Calculate the total tax credits available.
9 Calculate total withholding and tax payments.
10. Calculate the amount overpaid (refund):
11. Calculate the amount of taxes owed:
In: Accounting
Note: This problem is for the 2018 tax year.
Lance H. and Wanda B. Dean are married and live at 431 Yucca Drive, Santa Fe, NM 87501. Lance works for the convention bureau of the local Chamber of Commerce, while Wanda is employed part-time as a paralegal for a law firm.
During 2018, the Deans had the following receipts:
|
Wanda was previously married to John Allen. When they divorced several years ago, Wanda was awarded custody of their two children, Penny and Kyle. (Note: Wanda has never issued a Form 8332 waiver.) Under the divorce decree, John was obligated to pay alimony and child support—the alimony payments were to terminate if Wanda remarried.
In July, while going to lunch in downtown Santa Fe, Wanda was injured by a tour bus. As the driver was clearly at fault, the owner of the bus, Roadrunner Touring Company, paid her medical expenses (including a one-week stay in a hospital). To avoid a lawsuit, Roadrunner also transferred $90,000 to her in settlement of the personal injuries she sustained.
The Deans had the following expenditures for 2018:
|
The life insurance policy was taken out by Lance several years ago and designates Wanda as the beneficiary. As a part-time employee, Wanda is excluded from coverage under her employer's pension plan. Consequently, she provides for her own retirement with a traditional IRA obtained at a local trust company. Because the mayor is a member of the local Chamber of Commerce, Lance felt compelled to make the political contribution.
The Deans' household includes the following, for whom they provide more than half of the support:
|
Penny graduated from high school on May 9, 2018, and is undecided about college. During 2018, she earned $8,500 (placed in a savings account) playing a harp in the lobby of a local hotel. Wayne is Wanda's widower father who died on January 20, 2018. For the past few years, Wayne qualified as a dependent of the Deans.
Federal income tax withheld is $5,200 (Lance) and $2,100 (Wanda). The proper amount of Social Security and Medicare tax was withheld.
Required:
Determine the Federal income tax for 2018 for the Deans on a joint return by providing the following information that would appear on Form 1040 and Schedule A. They do not want to contribute to the Presidential Election Campaign Fund. All members of the family had health care coverage for all of 2018. If an overpayment results, it is to be refunded to them.
· Make realistic assumptions about any missing data.
· Enter all amounts as positive numbers.
· If an amount box does not require an entry or the answer is zero, enter "0".
· When computing the tax liability, do not round your immediate calculations. If required round your final answers to the nearest dollar.
Form 1040 Tax Items
Provide the following that would be reported on Lance and Wanda Dean's Form 1040.
1. Filing status and dependents: The
taxpayers' filing status:
Qualifies as the taxpayers' dependent: Select "Yes" or
"No".
Penny:
Kyle:
2. Calculate taxable gross
income.
$
3. Calculate the total adjustments for
AGI.
$
4. Calculate adjusted gross
income.
$
5. Calculate the greater of the
standard deduction or itemized deductions.
$
6. Calculate total taxable
income.
$
7. Calculate the income tax
liability.
$
8. Calculate the total tax credits
available.
$
9 Calculate total withholding and tax
payments.
$
10. Calculate the amount overpaid
(refund):
$
11. Calculate the amount of taxes
owed:
$
In: Accounting