Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I am doing some review for an exam thats coming up...need some help with som

ID: 3625491 • Letter: H

Question

Hi,

I am doing some review for an exam thats coming up...need some help with some pracitice java programs...

1)Start with $1. For each day, get another $1 plus half of what you already have. For example,
day 1: $1
day 2: $1 + 0.50 = $1.50, so altogether you have $2.50
day 3: $1 + 1.25 = $2.25, so altogether you have $4.75
and so on ...
Figure out how many days it will take for you to have more than $1,000,000.
________________________________________________________________________
2)Compute and display a table of grades. The data consists of an unknown number of classes worth
of data, terminated in a zero for the class number. Each class has an unknown number of students,
terminated with a zero. The data for one student consists of an id number and 10 grades. Compute
each student's average and each class average (average of the averages).


Sample data:
161
3333 70 60 50 82 55 78 95 80 75 84
4444 50 50 50 70 60 50 45 55 65 42
5555 80 90 80 74 86 90 75 75 87 65
0
162
1212 90 85 92 80 70 72 88 95 79 99
6666 60 80 90 80 90 80 74 86 90 80
7777 90 90 90 90 90 90 90 90 90 90
8888 95 87 93 82 55 78 95 80 75 84
9999 75 77 73 50 60 55 62 43 45 50
0
263
2222 90 65 75 60 80 90 75 75 87 65
8989 60 40 60 80 90 80 74 86 72 67
0
343
2233 90 65 75 82 55 78 95 80 75 84
4455 60 40 60 60 80 90 70 74 73 84
9090 70 80 30 80 90 80 74 86 89 97
0
0
For the sample data, the output of your program would be as follows:
Grade data for 161
ID Number Student Average
--------- ---------------
3333 ...
4444 ...
5555 ...
Class average: ...
Grade data for 162
ID Number Student Average
--------- ---------------
1212 ...
6666 ...
7777 ...
8888 ...
9999 ...
Class average:...
___________________________________________________________________


3)Assume a variable n is declared as int and x is declared as double. And assume both have positive
numbers stored in them. Write a segment of code to compute x^n. Then, Write a segment of code to compute n! .
Now compute ex which is equal to 1 + x + x2/2! + x3/3! + ... + xn/n!


__________________________________________________________________

It would be so great if someone could do them all!!! I would be so grateful!! If not please do 2 and 3...thanks!! Also, if you could explain in detail on how you did it or why you should you answer it this way that would be great thanks!

Explanation / Answer

please rate - thanks

I think these are self explanatory. if you have any questions message me

(you got me in a good mood)

import java.util.*;
public class main
{
    public static void main(String[] args)
    {
    double have =1;
    int days=1;
    System.out.println("Day $ have");
    while(have<1000000)
        {System.out.println(days+" "+have);
        days++;
        have=have+1+.5*have;    
   
             }   
    System.out.println(days+" "+have);
    System.out.println("On day "+days+" you will have more than $1000000");                                 
    }
               
}

------------------------------------------

import java.util.*;
public class main
{
    public static void main(String[] args)
    {
    double seq =1;
    int x=2,n=3,i=1,num=1;    //num=numerator
    for(i=1;i<=n;i++)
          {num*=x;            //keep running x^n
            seq=seq+num/(double)fact(i);                
            }   
        System.out.println("sum= "+seq);                             
    }
       
public static int fact(int n)
        {int i,f=1;
        for (i=2;i<=n;i++)
             f*=i;
        return f;
        }
}

----------------------

import java.util.*;
import java.io.*;
public class FileIn
{public static void main(String[] args)throws FileNotFoundException
{String filename;
Scanner in=new Scanner(System.in);
System.out.print("Enter file name: ");
filename=in.nextLine();
Scanner input=new Scanner(new File(filename));
int classnum;
int count=0,total,id,grade;
int classtot=0,i;
double average;
classnum=input.nextInt();
while(classnum!=0)
    {System.out.println("Grade data for "+classnum);
    System.out.println("ID Average");
    count=0;
    classtot=0;
    id=input.nextInt();
    while(id!=0)
          {total=0;
            count++;
            for(i=0;i<10;i++)
                {grade=input.nextInt();
                total+=grade;
                }
            average=total/10.;
            classtot+=average;
            System.out.println(id+" "+average);
            id=input.nextInt();
            }
        System.out.println("Class Average: "+classtot/(double)count+" ");
        classnum=input.nextInt();
      }
}  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote